I am trying to send two variable from child component to the parent component
I have placed the child selector to the parent component view , where I used child tag and bind the @output name myOutput to the getData function in the parent component and passed the event handler to it
<app-form-test [myInput]='myInputString' (myOutput)="getData($event)"></app-form-test>
parent ts file =>
getData(value) {
alert(value);
}
child ts file
export class FormTestComponent implements OnInit {
@Input() myInput: [];
@Output() myOutput: EventEmitter<string> = new EventEmitter();
firstOutputString = 'hello I am coming from child component'
secondOutputString = " I am second string";
ngOnInit() {
}
SendData() {
this.myOutput.emit(this.firstOutputString);
}
}
Here I want to pass another variable secondOutputString to the parent component from child component I tried to pass it using
SendData() {
this.myOutput.emit(this.firstOutputString , this.secondOutputString);
}
But I am getting error