throws ERROR TypeError: Cannot read property 'emit' of undefined

For anyone that came here to find this, if Basarats solution did not work, check to make sure that the line above the event emitter does not have any typos. I had an unnamed ViewChild above my undefined EventEmitter.


Cannot read property 'emit' of undefined

Commonly caused by wrong this. Add the arrow lambda syntax =>

Fix

  private onStateChangeEvent = (event: any) => {
    console.log("reached here: " + event);
    this.myEmitter.emit(1); // now correct this
  }  

More

https://basarat.gitbooks.io/typescript/docs/arrow-functions.html