本文整理匯總了TypeScript中@angular/router-deprecated.Router.generate方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Router.generate方法的具體用法?TypeScript Router.generate怎麽用?TypeScript Router.generate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/router-deprecated.Router
的用法示例。
在下文中一共展示了Router.generate方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getItemUrl
getItemUrl(item: MenuItem): string {
if(item.url) {
if(Array.isArray(item.url))
return this.location.prepareExternalUrl(this.router.generate(item.url).toLinkUrl());
else
return item.url;
}
else {
return '#';
}
}
示例2: isCurrentRoute
isCurrentRoute(route){
var instruction = this._router.generate(route);
return this._router.isRouteActive(instruction);
}
示例3: isIndex
isIndex():boolean {
let instruction = this._router.generate(['Index']);
return this._router.isRouteActive(instruction);
}
示例4: xit
xit('should initialize Dashboard-route in Router', () =>{
var instruction = router.generate(['Dashboard']);
var path = instruction.toRootUrl();
expect(path).toEqual('');
});
示例5: getInternalLink
getInternalLink(hash: string, instructionName: string): string{
let instruction = this._router.generate([instructionName]);
let path = '/' + instruction.toUrlPath() + hash;
return path;
}
示例6: params
set params(changes: any[]) {
this._routeParams = changes;
this._navigationInstruction = this._router.generate(this._routeParams);
}