Skip to content

Instantly share code, notes, and snippets.

@alxvallejo
Created August 23, 2016 13:12
Show Gist options
  • Save alxvallejo/ee6e182e91a877704ca4c179749eb987 to your computer and use it in GitHub Desktop.
Save alxvallejo/ee6e182e91a877704ca4c179749eb987 to your computer and use it in GitHub Desktop.
if (!this.account) {
return $http
.post('/api/account/get', {})
.then((r) => {
this.account = BaseModel.parse(r);
return BaseModel.parse(r);
});
}
else {
let deferred = $q.defer();
deferred.resolve(this.account);
return deferred.promise;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment