I have the following code:
class Example {
.....
exampleNavigate(namedOutlet:string, data: any) {
const commands = [{
outlets: {
popup: [data.module, data.service, data.create]
}
}];
let queryParams = {}
queryParams['id'] = data.id;
this.router.navigate(commands, { queryParams } );
}
...
}
Currently, I'm always navigating to the "popup" outlet. I can navigate to namedOutlet
which is being passed through the exampleNavigate
function?
I found out that I just need to replace popup: [data.module, data.service, data.create]
to this [outletName] : [data.module, data.service, data.create]
and it work fine.
Follows the full working example:
class Example {
.....
exampleNavigate(namedOutlet:string, data: any) {
const commands = [{
outlets: {
[outletName]: [data.module, data.service, data.create]
}
}];
let queryParams = {}
queryParams['id'] = data.id;
this.router.navigate(commands, { queryParams } );
}
...
}