Angular 2 routes load another component based on parameter type
I need to load different components depending on the type of route parameter. if route parameters are string then load one component as shown below,
{ path: 'care/action/:string',component: StringComponent},
if the route parameters are a number then load another component as shown below
{ path: 'care/action/:number', component: NumberComponent},
Note that the URL will remain the same, only the type of the parameter will change.
How do you achieve this?
Thanks in advance.
+3
source to share