I following thinkster MEAN stack tutorial and I have a problem in angular factory service
angular.js:11598 Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: []
app.js
app.factory('posts', ['$http', function($http){
var o = {
posts: []
};
o.getAll = function() {
return $http.get('/posts').success(function(data){
console.log(data)
angular.copy(data, o.posts);
});
};
return o;
}]);
my config file has route provider
$stateProvider
.state('home', {
url: '/home',
templateUrl: '/home.html',
controller: 'MainCtrl',
resolve: {
post: ['$stateParams', 'posts', function($stateParams, posts) {
return posts.get($stateParams.id);
}]
}
})
Im not sure what is wrong..
Any help is much appreciated. Thanks in advance...