getTutorials
returns promise by itself. So you have to do then()
again.
tutorialService.getTutorials().then(function(data){
$scope.tutorials = data;
});
Before that, $http
returns a promise with success()
and error()
.
Although you can also use then
as well
Since the returned value of calling the $http function is a promise, you can also use the then method to register callbacks, and these callbacks will receive a single argument – an object representing the response.
So you are correct with that.