TypeError: Cannot read property 'undefined' of undefined IONIC 3

Guys I’m having this error in my code

Error: Uncaught (in promise): TypeError: Cannot read property 'undefined' of undefined
TypeError: Cannot read property 'undefined' of undefined
    at ConteudoPage.webpackJsonp.271.ConteudoPage.ngAfterContentInit (http://localhost:8100/build/main.js:4315:40)
    at callProviderLifecycles (http://localhost:8100/build/vendor.js:12776:18)
    at callElementProvidersLifecycles (http://localhost:8100/build/vendor.js:12753:13)
    at callLifecycleHooksChildrenFirst (http://localhost:8100/build/vendor.js:12737:17)
    at checkAndUpdateView (http://localhost:8100/build/vendor.js:13865:5)
    at callViewAction (http://localhost:8100/build/vendor.js:14212:21)
    at execComponentViewsAction (http://localhost:8100/build/vendor.js:14144:13)
    at Object.checkAndUpdateView (http://localhost:8100/build/vendor.js:13868:5)
    at ViewRef_.detectChanges (http://localhost:8100/build/vendor.js:11654:18)
    at NavControllerBase._viewAttachToDOM (http://localhost:8100/build/vendor.js:54175:40)
    at c (http://localhost:8100/build/polyfills.js:3:19752)
    at Object.reject (http://localhost:8100/build/polyfills.js:3:19174)
    at NavControllerBase._fireError (http://localhost:8100/build/vendor.js:53938:16)
    at NavControllerBase._failed (http://localhost:8100/build/vendor.js:53931:14)
    at http://localhost:8100/build/vendor.js:53978:59
    at t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
    at Object.onInvoke (http://localhost:8100/build/vendor.js:4983:33)
    at t.invoke (http://localhost:8100/build/polyfills.js:3:14916)
    at r.run (http://localhost:8100/build/polyfills.js:3:10143)
    at http://localhost:8100/build/polyfills.js:3:20242

I am finding the error in this line of code, the error is being found in this IF, could someone help me?

ngAfterContentInit(){ console.log('Carregando After') this.loading.present();

this.events.subscribe('aulaConteudo:loadingVideo', () =>{
  this.exibirConteudo = false;
  let monitor:HTMLDivElement = this.content._elementRef.nativeElement.querySelector('.monitor');
  monitor.style.visibility = 'hidden';
});

 console.log(this.navParams)
 this.aula = this.navParams.data.aula;
 this.aulaOrdem = this.navParams.data.aulaOrdem;
 this.moduloOrdem = this.navParams.data.moduloOrdem;
 this.cursoId = this.navParams.get('cursoId');
 this.usuario = this.navParams.get('usuario');
 this.tituloCurso =  "teste"; //this.aula.tituloCurso;
 this.paginasTotal = 8;

 if (this.aulaOrdem == 1 && this.moduloOrdem == 1) {
   this.prev = true;
 }

 if (this.aulaOrdem == this.aula[this.moduloOrdem].aulas.length - 1 && this.moduloOrdem == this.aula.length - 1) {
   this.next = false;
 } `

I really dislike Events, because they have no type safety, are very prone to typos, and encourage code that is hard to read, hard to maintain, and hard to test. Direct DOM access is also frowned upon in Angular apps, and accessing private properties like _elementRef should be avoided if at all humanly possible.

So the first thing I would do is refactor the design and make those things go away. I’m guessing you’re not going to want to hear that, though, so glancing at your stack trace, how about turning on the compiler options described in this post and seeing if anything shakes out?