Reputation: 95
debugger tells me there's a ; missing before the statement at the line with personSrv.getAllpersons() in my code , but I have no idea where I'd need to put it.
.controller('personsCtrl', ['$scope', 'personSrv', function personsCtrl($scope, personSrv) {
personSrv.getAllpersons().success(response){
$scope.persons = response.data.rows;
}
}])
Upvotes: 0
Views: 288
Reputation: 1968
personSrv.getAllpersons().success(response){
$scope.persons = response.data.rows;
}
The code snippet above contains an incorrect function expression, you are missing the important keywords. This would be correct:
personSrv.getAllpersons().success(function(response){
$scope.persons = response.data.rows;
})
However keep in mind that .success
is deprecated and should not be used.
Edit:
Instead of .success(SUCCESS-CB)
consider using .then(SUCCESS-CB, ERROR-CB)
or even .then(SUCCESS-CB).catch(ERROR-CB)
. Personally, I prefer the last one as it is easy on the eyes.
Upvotes: 1