angular - How to perform routing relative to parent module in Angular2 -
i working on angular2 application @ngrx , @ngrx/router-store routing actions.
i trying restructure application try follow module routing guidelines described in guide: https://angular.io/docs/ts/latest/guide/router.html#!#crisis-child-routes
the application building allows user log accounts particular 'location'. once user logs in, url contains current location start, similar user/account showing when logging gmail: https://mail.google.com/mail/u/0/
here general outline of routes:
/login /location/:id <-- locationmodule/locationroutingmodule /location/:id/home <-- homemodule/homeroutingmodule /location/:id/calendars <-- calendarmodule/calendarroutingmodule /location/:id/calendars/:cid /location/:id/clients <-- clientmodule/clientroutingmodule /location/:id/clients/:cid /location/:id/clients/:cid/... now, i'd individual feature modules (home, calendar, client) not have know "where reside" in route (i.e. don't know if exist child of '/' or '/location/:id'.
this fine long there no routes between features. however, there cases necessary navigate between feature areas/modules(i trying minimize these). example, there link on "home" component should route calendar.
the ideas have (neither of particularly like):
- a service provided @
locationmodulelevel child modules use routing: - an @ngrx effect "outside"
homemoduletriggers on action "select_calendar" , knows correct "base" route use route calendar feature area
is there other clean way implement this? different module structure/hierarchy?
if not, arguments or against 2 potential implementations? suggestions how best go implementing?
thanks
Comments
Post a Comment