本文整理匯總了TypeScript中@angular/router-deprecated.Router.isRouteActive方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Router.isRouteActive方法的具體用法?TypeScript Router.isRouteActive怎麽用?TypeScript Router.isRouteActive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/router-deprecated.Router
的用法示例。
在下文中一共展示了Router.isRouteActive方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: isRouteActive
public isRouteActive(routeInQuestion) {
if (routeInQuestion == null) {
return false;
}
if (routeInQuestion == AppConfig.ROUTE_NAME_ADMIN) {
var currentInstruction = this._router.currentInstruction;
if (currentInstruction == null) {
return false;
}
return currentInstruction.component.urlPath == 'admin';
}
try {
return this._router.isRouteActive(this._router.generate([ routeInQuestion ]));
} catch (ex) {
return false;
}
}
示例2: isCurrentRoute
isCurrentRoute(route){
var instruction = this._router.generate(route);
return this._router.isRouteActive(instruction);
}
示例3: isActive
isActive(instruction: any[]): boolean {
return this._router.isRouteActive(this._router.generate(instruction));
}
示例4: isIndex
isIndex():boolean {
let instruction = this._router.generate(['Index']);
return this._router.isRouteActive(instruction);
}
示例5: isActive
isActive(route) {
return this.router.isRouteActive(this.router.generate(route));
}
示例6: update
private update() {
this.active = this.params && this.router.isRouteActive(this.router.generate(this.params));
}
示例7: constructor
constructor(public router: Router) {
// Do stuff
console.log('ROUTER DEBUG', router, this.router.isRouteActive(this.router.generate(['Home'])));
}
示例8: isRouteActive
// Here's how you determine if a current route is active in ng2
isRouteActive(route: string): boolean {
return this.router.isRouteActive(this.router.generate([route]));
}
示例9: isRouteActive
get isRouteActive(): boolean { return this._router.isRouteActive(this._navigationInstruction); }
示例10: isActive
isActive(instruction: string[]): boolean {
return this._route.isRouteActive(this._route.generate(instruction));
}