本文整理匯總了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]);
}