In Angular2, although I have a named outlet, how can I go to another route with a matrix parameter AND close the named outlet?

I use named outputs to display the sidebar. Works great:

router.navigate(['/', {outlets: {sidebar: 'profile'}}])

I also have a button that clicks to close the sidebar. Also works great:

router.navigate(['/', {outlets: {sidebar: null}}])

Another button should close the side panel and go to the contacts with the matrix parameters

router.navigate(['/', {outlets: {sidebar: null, primary: "contacts"}}]">

I can route, but failed to pass parameters.

+4
source share
1 answer

I'm not sure what you have tried so far, but something like this work?

router.navigate(['/', {outlets: {sidebar: null, 
                       primary: ["/contacts", {field: value}]}}]"
+2
source

Source: https://habr.com/ru/post/1680988/


All Articles