angular - Submenu with angular2 -


i have menu on left side of page , there has menu on left submenu of selected menu. work i've created non-terminal route '/section/...' , created component router outlet in it. component in "section" folder router component. had use links make work (the "./" had added here links specific subcomponent):

<a [routerlink]=" ['./index'] ">index</a> <a [routerlink]=" ['./test'] ">test</a> 

everything works perfectly, turn hrefs submenu separate component. don't want hardcode menu in every section, i'd rather place tag , somehow specify links added submenu. problem here i'm stuck , don't know how pass links submenu component still point correct locations. best way create such submenu component , pass list of links it?

i solved similar use case using single parameter of route menu path , other part of path actual content route path like

http://myapp/main_menu.sub_menu3.sub_sub_menu5/some_content/details 

witha route config like

{path: '/:menu/...', name: 'mainarea', component: mainareacomponent} 

i inject router navbar component , listen changes , update navbar-view depending on passed menu parameter , call this.router.navigate(...) updated menu parameter value reflecting navigation change in menu , path required show main content depending on selected menu.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -