本文整理汇总了TypeScript中@angular/router.Router类的典型用法代码示例。如果您正苦于以下问题:TypeScript Router类的具体用法?TypeScript Router怎么用?TypeScript Router使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Router类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: canActivate
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
if(this.authService.getCookie('token')){
this.router.navigate(['/'])
}
return true
}
示例2: train
train(intent) {
this._router.navigate(["/agent/default/train-intent", intent._id.$oid])
}
示例3: requestResetPassword
requestResetPassword() {
this.activeModal.dismiss('to state requestReset');
this.router.navigate(['/reset', 'request']);
}
示例4: home
home() {
this.router.navigate(['']);
}
示例5: products
products(){
this.router.navigate(['products']);
}
示例6: tap
tap(action => {
this.router.navigate(['']);
this.localStorageService.setItem(AUTH_KEY, { isAuthenticated: false });
})
示例7:
).subscribe(() => this.router.navigate([ '..' ], { relativeTo: this.route }));
开发者ID:our-city-app,项目名称:plugin-mobicage-control-center,代码行数:1,代码来源:update-embedded-app-page.component.ts
示例8: checkcredentials
checkcredentials(){
if(localStorage.getItem("user") === null){
this._router.navigate(['login']);
}
}
示例9: logout
logout(){
localStorage.removeItem("user");
this._router.navigate(['login']);
}
示例10: clicked
clicked(product: Product): void {
this.currentProduct = product;
this.onProductSelected.emit(product);
this.router.navigate(['/product', product.sku]);
}