Example: www.example.com/dashboard
I want to detect if user is Customer, it will load CustomerDashboardModule, if user is Staff, it's StaffDashboardModule, if user is Admin, it's AdminDashboardModule but the url is still /dashboard
Example code:
export const routes: Routes = [
{
path: '',
component: DashboardComponent,
children: [
{
path: '',
loadChildren: condition ? 'x' : 'y'
}
]
}];
But it doesn't work.
Second problem is
How to detech User? Call an service of CoreModule. A solution is create a static property Injector in CoreModule and inject Injector in its constructor but I don't know if it's a good practice?