4

When I have an error happen inside ngOnInit() that error seems to be bubbled up with an TypeError: this._unregisterListenersFn is not a function error instead.

Example:

constructor() {
   throw Error('error in constructor');
}

gives expected result in console window. but in ngOnInit():

ngOnInit() {
   throw Error('error in ngOnInit')
}

gives first 'error in ngOnInit' as expected, but also

TypeError: this._unregisterListenersFn is not a function

I'm trying to handle all errors with an custom error handler, but when an error happens inside ngOnInit() I only get the latest error, and not the error causing the errors in the first place.

Edit-follow-up: I think I've found the root cause in NgbPopover. The error Message shown in Chrome Developer Tools is:

TypeError: this._unregisterListenersFn is not a function
    at NgbPopover.webpackJsonp.../../../../@ng-bootstrap/ng-bootstrap/popover/popover.js.NgbPopover.ngOnDestroy (popover.js:128)
jonas
  • 1,592
  • 3
  • 20
  • 29

0 Answers0