本文整理汇总了TypeScript中services/AuthService.AuthService类的典型用法代码示例。如果您正苦于以下问题:TypeScript AuthService类的具体用法?TypeScript AuthService怎么用?TypeScript AuthService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AuthService类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
(nextInstr: any, currInstr: any) => {
let injector: any = Injector.resolveAndCreate([AuthService]);
let authService: AuthService = injector.get(AuthService);
console.log('nextInstr', nextInstr);
console.log('currInstr', currInstr);
return authService.isLogged();
}
示例2:
(nextInstr: any, currInstr: any) => {
let injector: any = ReflectiveInjector.resolveAndCreate([AuthService]);
let authService: AuthService = injector.get(AuthService);
return authService.isLogged();
}
示例3: login
login(username: string, password: string): boolean {
this.message = '';
if (!this.authService.login(username, password)) {
this.message = 'Incorrect credentials.';
setTimeout(function() {
this.message = '';
}.bind(this), 2500);
}
return false;
}
示例4: logout
logout(): boolean {
this.authService.logout();
return false;
}
示例5: canActivate
canActivate(): boolean {
return this.authService.isLoggedIn();
}