the way i handled passing any arguments from my child to parent (looks to me thats what you need here)
first in my child component i define my eventEmitter and initialise my array which i want to pass to my parent
//child component.ts
array: any[] = [];
@Output() passArray = new Eventemitter
then i write a function which calls my eventemitter and emit my array like this
// child component.ts
emitArray() {
this.passArray.emit(array);
}
Now i go into the HTML of my parent component where my child component is located
here i can listen to the eventEmitter by putting it into brackets like this
// parent component.html
<custom-component (passArray)="yourFunction($event)"><custom-component>
// parent component.ts
yourFunction(parameter) {
do.something()
}
so once the passArray.emit is called our parent component which is listening to it in the html executes the "yourFunction" whith the parameters which it gets from the $event. the $event is our data which we passed in our child component. for more detailed information on how to pass data around in angular you can read throught the docs on https://angular.io/docs. they do a good job explaining many topics :) (better than me :D)
this is one of my first answers so sry if its a bit messy :) i hope i was able to help ;)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…