我想通过这种方式将参数传递给另一个页面:
const navParams:NavigationExtras = {state: {functionalityId:'my id'}};
this.router.navigate(['processes'], navParams);
但这给了我以下错误:
Type '{ state: { functionalityId: string; }; }' is not assignable to type 'NavigationExtras'.
Object literal may only specify known properties, and 'state' does not exist in type 'NavigationExtras'.
我也尝试过直接在导航内传递参数:
this.router.navigate(['processes'], {functionalityId:'my id'});
但我有(几乎)相同的错误:
Argument of type '{ functionalityId: string; }' is not assignable to parameter of type 'NavigationExtras'.
Object literal may only specify known properties, and 'functionalityId' does not exist in type 'NavigationExtras'
最佳答案
您的语法错误。您需要将方括号放在行尾,如下所示:this.router.navigate(['processes', { functionalityId: 'my id' }])
关于angular - Angular 路由参数“状态”在类型“NavigationExtras”中不存在,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56113155/