A
A
Adel Khalitov2019-03-24 23:17:40
Angular
Adel Khalitov, 2019-03-24 23:17:40

How to hide routing parent in angular?

Good day everyone. I have a routing scheme:

const routes: Routes = [
  { path: '', component: RegularComponent },
  { path: 'crm', component: LoginComponent ,
  children: [
    { path: 'newlead', component: NewLeadComponent, canActivate: [AuthGuard] },
    { path: 'leadlist', component: LeadListComponent, canActivate: [AuthGuard],
      children: [
        { path: ':id', component: LeadPageComponent, canActivate: [AuthGuard] },
      ]
    },
  ]},
];

Where there are child elements, in the LoginComponent component I insert a tag in order to display the child element. Everything works fine, except that when going to a child element, both parent and child elements are displayed. How can I make the parent element hidden? <router-outlet></router-outlet>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2019-03-24
@SaveLolliPoP

Subscribe to activatedRouter, check it out and set the hide flag. Well, the content in the parent under ngIf.
But if such a need arose, most likely you are doing something architecturally wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question