Below is the content from my app-router.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DheaderComponent } from './dheader/dheader.component';
import { DdashboardComponent } from './ddashboard/ddashboard.component';
import { MdashboardComponent } from './mdashboard/mdashboard.component';
const routes: Routes = [
{ path:'', component:DheaderComponent},
{ path:'dashboard', if(1){component: DdashboardComponent } else { component :MdashboardComponent} },
{ path:'mdashboard',component:MdashboardComponent},
]
@NgModule({
imports: [ RouterModule.forRoot(routes) ],
exports: [ RouterModule ]
})
export class AppRoutingModule { }
Is it possible to display DdashboardComponent for Desktop users and MdashboardComponent for Mobile users on the same path which is path:'dashboard'?
If so, how can this be achieved and what are the recommended best practices?