Thursday, 25 April 2024

viewchild real time example

 below is the image of child component it is given in parent clss.

1.my ask is after saving purchase order final save we get poid then only we save below data to api

so. i need to click save function after poid created .

so i used viewchild concept like below.

using this we can access component all methods inside parent component.


while giving in constructor getting error.inject error

 @ViewChild(POOrderItemsListComponent, { static: false })
  public poList!: POOrderItemsListComponent;
  constructor(private poservice: PurchaseorderService,
    private poList: POOrderItemsListComponent)


here i am accessing child class method like below.
 cancel() {
    // Logic for cancel button
    this.poList.finalSave();
  }


No comments:

Post a Comment

Meet BootUI | Scan AI-Generated Code & Find What AI Missed !

 very usefull link to verify ai content https://www.youtube.com/watch?v=pULGt0Rme58 Click