1
votes

I have working router configured inside shell.js:

router.map([
  { route: 'messages', moduleId: 'views/messages', nav: true },
  { route: 'messages/create', moduleId: 'views/messagesCreate', nav: true },
]).buildNavigationModel();

What i want to do is to let my #messages route able to retrieve optional parameter id (/:id) something like this:

router.map([
      { route: 'messages(/:id)', moduleId: 'views/messages', nav: true },
      { route: 'messages/create', moduleId: 'views/messagesCreate', nav: true },
    ]).buildNavigationModel();

so i can navigate to messages page with or without parameter..

this is work fine, but the problem come when i want to navigate to messages/create page..

How can i accomplished this by without need to change my route name ?

Any help, idea or suggestions will greatly appreciated!
Thanks

1

1 Answers

3
votes

Change the order of your routes

router.map([
  { route: 'messages/create', moduleId: 'views/messagesCreate', nav: true },
  { route: 'messages(/:id)', moduleId: 'views/messages', nav: true },
]).buildNavigationModel();