Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- In service:
- function GetCurrent(controllerName) {
- console.log('called by '+controllerName);
- return $http.get('/api/users/current').then(handleSuccess, handleError);
- }
- function handleSuccess(res) {
- return $q.resolve(res.data);
- }
- function handleError(res) {
- return $q.reject(res.data);
- }
- In Controller:
- Service.GetCurrent('me')
- .then(function(data){
- console.log(data);
- })
- .catch(function(err){});
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

