Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide parent view in angular 2

Tags:

angular

I have to hide the above parent view.

enter image description here Following is my code. When I click any one of the box parent should be hide child should be appear.

        <app-navbar></app-navbar>
        <div class="container" [style.height]='height' style="margin-top: 7%;">
            <div class="row box_rpad">
                <app-box-layout 
                                (display)="onDisplay($event)" 
                                *ngFor="let color of colors let i=index" 
                                [color]='color.hex' 
                                [text]='color.name' 
                                [id]='i'>
                </app-box-layout>               
            </div>
        </div>

        <!-- CHILD ROUTES -->
        <div class="container">
            <router-outlet></router-outlet> 
        </div>
like image 267
I am Naresh Avatar asked Feb 09 '17 06:02

I am Naresh


1 Answers

January 2021

You can remove the component from the parent route. See example here

{
    path: 'parent',
    //component: ParentComponent,
    children: [
      { path : '', pathMatch:'full', component: ParentComponent},
      { path: 'child', component: ChildComponent },
    ],
  }  

like image 121
Vikash Rathee Avatar answered Oct 08 '22 03:10

Vikash Rathee