2

I was trying to use $http.get. The page only works if the url I give is a local 'vehicles.json' But when I give a url, it spits out a blank page. Could someone please help me understand my error?

1 Answers1

1

You have to replace this line:

 $scope.vehicle = data.['get_vehicles'];

for this:

$scope.vehicle = data['get_vehicles'];

If you modify this in your Plunker, will work.

I hope this solves your question.

borferpa
  • 86
  • 3
  • Did you check if the proglem is CORS? to check it you can open the console (F12 in Chrome) and look at if appear some message saying something like "XMLHttpRequest cannot load http://domain.example. Origin http://domain.example is not allowed by Access-Control-Allow-Origin." If your problem is this, you can transform your chrome with disable security (http://stackoverflow.com/questions/3102819/disable-same-origin-policy-in-chrome) – borferpa Aug 13 '15 at 06:24