I am looking for implementing multi tenant routing mechanism where the URL
should look like:
myapp.com/tenant-1/dashboard,
myapp.com/tenant-2/dashboard.
I am looking for implementing multi tenant routing mechanism where the URL
should look like:
myapp.com/tenant-1/dashboard,
myapp.com/tenant-2/dashboard.
You'll have to declare your routing like this, where /:tenant_id will be dynamically generated.
{
path: 'tenant/:tenant_id',
children: [
{ path: 'dashboard', component: DashboardComponent },
{ path: 'SomeOther', component: SomeOtherComponent }
]
}
You'll read the :tenant_id with the below code:
this.subscription = this.activatedRoute.queryParams.subscribe((params: Params) => {
let tenant_id = params['tenant_id'];
console.log(tenant_id);
});
Then your routing declaration should look like this :
{ path: ':tenant', children: [
{ path: 'dashboard', component: DashboardComponent }
]}