so I have this code -
@Component({
tag: "app-home",
styleUrl: "app-home.css"
})
export class AppHome {
@Event()
myEvent: EventEmitter;
callEv() {
this.myEvent.emit("hello");
}
render() {
return (
<div class="app-home">
<button onClick={this.callEv}>Hello</button>
</div>
);
}
}
When the button is clicked, I get this error in the console -
Uncaught TypeError: Cannot read property 'emit' of undefined at HTMLButtonElement.callEv
Any idea why?