Looking for data from an api through $ http.get, but I find an error.
My request within a service:
app.service('pessoas',function($http){
this.getHumanos = function(callback){
$http.get('http://private-ff1c4-grupo.apiary-mock.com/pessoas').success(callback);
};
});
and Here where inside my controller where I get the data:
app.controller('servico',function($scope, pessoas){
pessoas.getHumanos(function(data){
$scope.pessoas = data;
});
});
Error shown in console:
SyntaxError: Unexpected token i
at Object.parse (native)
at pc (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:14:208)
at Zb (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:76:379)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:77:237
at s (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:7:302)
at Zc (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:77:219)
at c (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:78:349)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:112:20
at l.$eval (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:125:305)
at l.$digest (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:122:398)