Skip to content

Instantly share code, notes, and snippets.

@ben-barbier
Last active March 10, 2017 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ben-barbier/1936616ff641ea367e0cb36aeaf9f8d1 to your computer and use it in GitHub Desktop.
Save ben-barbier/1936616ff641ea367e0cb36aeaf9f8d1 to your computer and use it in GitHub Desktop.
export class AuthenticationService {
loginState: Subject<any> = new Subject();
constructor(private http: Http) {
}
logout() {
this.http.get('http://logout...')
.subscribe(() => {
// Question: comment récupérer la référence du service le plus proprement possible
// Pb : ici this ne représente pas le AuthenticationService mais l'appelant
this.loginState.next({event: 'LOGOUT'});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment