Is it possible to place a condition on component property of a route?
For example,
let routes: Routes = [];
routes = [
{path: '',
if (data == 1)
{ component: component1 } }
]
Or is there a way to do conditional routing without the use of auth guards?
CodePudding user response:
You could use the ternary operator to set the component value by condition
{ component: data == 1 ? component1 : otherComponent }
Hope this helps
CodePudding user response:
{ path:'', component: (() => { return (data==1) ? component1; })() }