Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular routing parameters 'state' does not exist in type 'NavigationExtras

I want to pass parameters to another page, this way:

const navParams:NavigationExtras = {state: {functionalityId:'my id'}};
this.router.navigate(['processes'], navParams);

but it gives me the following error:

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'.

I've also tried to pass parameters directly inside navigate:

this.router.navigate(['processes'], {functionalityId:'my id'});

but I have the (almost) same error:

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'
like image 454
Usr Avatar asked Apr 01 '26 08:04

Usr


1 Answers

Your syntax is wrong. You need the end square bracket to be placed towards the end of the line, like this: this.router.navigate(['processes', { functionalityId: 'my id' }])

like image 105
idksoiputthis Avatar answered Apr 02 '26 21:04

idksoiputthis