我可以将参数传递给路线并使用此代码导航到那里:
this.router.navigateToRoute('CaseList', { RefNo: this.selectedData.RefNo
}, { replace: true })
Run Code Online (Sandbox Code Playgroud)
参数正确传递到新页面.
但是,我想在新标签页中打开该页面.我试过了:
window.open(this.router.generate('CaseList', { RefNo:
this.selectedData.RefNo }),'_blank');
Run Code Online (Sandbox Code Playgroud)
这将打开一个新选项卡,并将参数值附加到URL,例如http:// localhost:49328/AppCaseMgmt/CaseList/20150000015,但如果我尝试在激活时读取参数的值,如下所示:
activate(params) {
console.log('activate in case list');
console.log(params.RefNo);
....
}
Run Code Online (Sandbox Code Playgroud)
这是未定义的.
我正在使用路由器动态添加路由
this.router.addRoute({
route: "/AppCaseMgmt/CaseList/:RefNo", name: "CaseList", moduleId: "app/case-management/case-list",
title: "CaseMgmt:CaseManagement_SiteMapHeaderCaseManagement_title" });
this.router.refreshNavigation();
Run Code Online (Sandbox Code Playgroud)
但据我所知,这不应该有所作为.(我尝试将路由添加到config.map,但没有成功).我开始认为这是不可能的.有没有人有任何想法?
谢谢,安东尼