I am trying to expose an angular service property to $scope, to use it in the view my code looks like this
/**API Post SERVICE for user login*/
function login(username,password){
return $http.post('/api/login/',{
username:username,
password:password
}).then(loginSuccessFn, loginErrorFn);
function loginSuccessFn(data, status, headers, config){
Authentication.setAuthenticatedAccount(data.data);
window.location = '/';
}
function loginErrorFn(data, status, headers,config){
console.error("Epic Failure");
}
}
so when the $http method returns error and the function loginErrorFn() is called, the response data to be passed in the view, so I may raise an bootstrap alert
How can i achieve this ?