initUserProfile: function() {
return $http.get('myapi/user/profil').
then(function(response) {
current_user = response.data;
if (current_user.profilpicture) {
current_user.profilpicture = $rootScope.baseURL + "/images/users/" + current_user.username + "/" + current_user.profilpicture;
}
}, function(err) {
// log error
});
};
I want this to return a promise, here it's the case but it's the $http success promise. How can i do to return a promise when the changes inside the then() are completed ?