0

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;
    }
}])

1
  • Where is personSrv.getAllpersons() getting it's data from? I ran into a similar issue when I didn't realize the data was coming from a JSONP service and was trying to call a callback Commented Nov 1, 2016 at 22:33

1 Answer 1

1
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.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.