0

when I click on the about ceo link on the dashboard component it should trigger load click function. about ceo component loading on dashboard component as in router-outlet

    // Dashboard component html (parent component)

    <div class="parent">
        <div class="left">
            <div class="menu">
               <a href="#" routerLink="aboutceo" (click)="Clickload()">About CEO</a>
            </div>   
        </div>
        <div class="right">
            <router-outlet></router-outlet>  
        </div>
    </div>
    // dashboard component ts (parent component)

    export class DashboardComponent implements OnInit {
    
      @ViewChild(AboutceoComponent, {static:true}) 
      private aboutceo: AboutceoComponent;
    
      constructor(private router:Router) {}
    
      Clickload(){
        this.aboutceo.loadClick();
      }
    }
    // aboutceo component ts (child component)

    export class AboutceoComponent implements OnInit {
    
      loadclick(){
        alert("welcome");
      }
    }

i tried using viewchild but its not working

Brandon Taylor
  • 33,823
  • 15
  • 104
  • 144

0 Answers0