Last active
August 28, 2020 20:20
-
-
Save elpddev/4dca604878e70a47cc0129512d01fb0d to your computer and use it in GitHub Desktop.
Auth Service #angularjs #medium #article-hierarchical-di-ng
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuthService { | |
static $inject = ['$http']; | |
private token: string; | |
constructor($http: IHttpService) {} | |
getToken() { | |
if (_.isNil(this.token)) { | |
this.token = $http.get('my-site.example.com/auth'); | |
} | |
return this.token; | |
} | |
} | |
moviesApp.service('auth', AuthService); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment