0

This questions has been answered on a different post. See here: Displaying json data in an Angular App

1
  • The json data will not display, simple arithmethic expressions would even fail to compute within the controller div. Commented Nov 4, 2015 at 8:19

1 Answer 1

1

Here is the demo http://dojo.telerik.com/UkUbE

 var app =angular.module('PhoneCat',[]);
app.factory('info', ['$http', function($http){ 
  var data = {};
  data.getInfo = $http.get('http://cdn.rawgit.com/angular/angular-phonecat/master/app/phones/phones.json')
  .success(function(data){
     return data;
  })
   .error(function(err){
     return err;
   });

  return data;

 }]);
app.controller('HomeController', ['$scope','info',
function($scope, info) {
info.getInfo.then(function(res){
    $scope.datar = res.data;
 });  
}]);

Hope this may help you

Sign up to request clarification or add additional context in comments.

2 Comments

For me the success and error methods in info service are useless
The code above seem to work, I believe the error has to do with the specific json feed I'm trying to work with (which doesn't seem to work), this: api.flickr.com/services/feeds/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.