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

Car pooling app

 I'll create a car pooling app with real-time vehicle tracking, pickup/drop time estimates, and a list of onboard users. Since we don...