Despite having all my event emitters set up correctly, there's one that seems to be causing issues.
child.ts:
@Component({
...
outputs: ['fileUploaded']
})
export class childComponent implements OnInit {
...
fileUploaded = new EventEmitter<boolean>();
...
randomMethod(){
...
this.fileUploaded.emit(true);
}
}
The randomMethod()
function is triggered from the parent component as illustrated in parent.ts, but not from child.html
.
parent.html
...
<child (fileUploaded)="onSubmit($event)"></child>
..
parent.ts
export class parentComponent {
...
theChild = new childComponent;
submitted = false;
...
onSubmit(event: boolean) {
console.log('in onSubmit()');
this.submitted = event;
}
functionCallsChild(){
this.theChild.randomMethod();
...
this.theChild = new childComponent;
}
}
Even though I expect "in onSubmit()" to be logged by my app, it never shows up. Why might onSubmit()
not be getting called? I also attempted removing the instantiation of a new child object on the last line, but it didn't solve the problem.