1
votes

I want to create duplicate view, viewmodel using exiting in Aurelia Framework.

For example, I have an existing route,

{ route: "pageA", moduleId: "views/pageA", nav: true, title: "PageA" }

Now I want to create new route dynamically, for example:

{ route: "pageA1", moduleId: "views/pageA", nav: false, title: "PageA1" }

I am using the below code to solve my problem

this.router.addRoute({ route: "pageA1", moduleId: "views/pageA", nav: true, title: "PageA1" });
this.router.refreshNavigation();`

The new routes are getting added in the route collection object but navigation is not happening(this.router.navigate('PageA1').

Can anyone tell me how to solve this issue and achieve dynamic routes in the application.

1

1 Answers

2
votes

I noticed in your question you wrote

but navigation is not happening this.router.navigate('PageA1').

Shouldn't that be a lower-case P? eg:

this.router.navigate('pageA1')