We have a requirement in which, depending on the static / global setting that will be set depending on the client, they want another component to load for the route. The reason is that they want to differ slightly from the functionality for the part of the application, so we are going to write a component for each that suits their scripts. Is there a way to select the component for the route dynamically / at runtime and keep the same route / url. The following is a simplified example of what we would like to achieve:
Component1:
@Component({
selector: 'customeronecomponent',
templateUrl: './customeronecomponent.component.html'
})
export class CustomerOneComponent implements OnInit {
}
Component2:
@Component({
selector: 'customertwocomponent',
templateUrl: './customertwocomponent.component.html'
})
export class CustomerTwoComponent implements OnInit {
}
Route:
{ path: 'home', component: CustomerComponentProvider },
In this case, the CustomerComponentProvider will internally check the configuration and return a CustomerOneComponent or CustomerTwoComponent.
angular2/4 , , , , , .