Hi Garwan50.
You do not need to use a custom promise.
app.factory('tmdb', ['$http', '$log', function($http, $log) {
return {
movie: function(id) {
return $http.get('
https://api.themoviedb.org/3/movie/'+id+'?api_key=3b21647fbda0a5b52703c04d6e74169e&language=fr').then(function(response)
<https://api.themoviedb.org/3/movie/'+id+'?api_key=3b21647fbda0a5b52703c04d6e74169e&language=fr%27).then(function(response)>
{
$log.info(response); // what i want
return response;
});
}
};
}]);
tmdb.movie(id).then(function(response) { // to do something with response
}); // code in controller
the result of $ http is promise, there is no point in doing a custom
promise with $q service.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.