Skip to main content

Posts

Showing posts with the label route configurations

Is it possible to have a multiple router-outlet in the same template?

Is it possible to have a multiple router-outlet in the same template? Yes, why not! We can use multiple router-outlets in the same template by configuring our routers and simply adds the router-outlet name. < div   class = "row" >    < div   class = "user" >      < router-outlet   name = "users" ></ router-outlet >    </ div >    < div   class = "detail" >      < router-outlet   name = "userDetail" ></ router-outlet >    </ div > </ div > And setups your route config and it looks like this. //Apps roots const   appRoots  = [    {  path:   '' ,  redirectTo:   '/dashboard' ,  pathMatch:   'full'  },    {  path:   'userDetail' ,  component:   UserDetailComponent  },  //Id is a Roots parameter. ...

What is Routes and Route Properties?

Angular Route is an array of route configurations. The “ RouterModule.forRoot ” method in the module imports to configure the router. type   Routes  =  Route []; Each Route has the following properties - interface   Route  {    path ?:  string    pathMatch ?:  string    matcher ?:  UrlMatcher    component ?:  Type < any >    redirectTo ?:  string    outlet ?:  string    canActivate ?:  any []    canActivateChild ?:  any []    canDeactivate ?:  any []    canLoad ?:  any []    data ?:  Data    resolve ?:  ResolveData    children ?:  Routes    loadChildren ?:  LoadChildren    runGuardsAndResolvers ?:  RunGuardsAndResolvers } List of properties and it has the following order - 1.  ...