I'm struggling to grasp this concept.
In my current scenario, I pass two variables to a component like this:
<app-selectcomp [plid]="plid" [codeId]="selectedCode" (notify)="getCompFromChild($event)"></app-selectcomp>
The variables I pass are plid and codeId.
Based on user actions with these variables, an array named response.data is generated.
To send this response.data to the parent component, I used the following method:
@Output() notify: EventEmitter<string> = new EventEmitter<string>();
this.notify.emit(this.response.data)
Then, in the parent component:
getCompFromChild(values): void {}
Everything functions properly, but I can only access the data from the parent component by triggering it from the child component, such as with a button click.
I haven't been able to figure out how to retrieve the value of response.data directly from the parent component. For instance, by clicking a button on the PARENT component.
<button type="submit" (click)="getDatainChild()">Get Child Data</button>
Thank you.