TypeError: b is undefined


#1

I have an Ionic2 app, that has just stopped working (not sure why).

The following command:

ionic serve

Builds the app with no errors, but when http://localhost:8100/ is loaded into the browser, I get:

TypeError: b is undefined

In order to debug this I tried to put a console.log at the top of app.ts constructor, but this is not being printed.

Does anyone have any ideas what is wrong, or were I should look to try diagnose this?

Thanks

UPDATE

I have been doing some more debugging, and I have found that this is related to inheritance of a variable I think.

I have the following code:

search.ts

export class SearchPage extends SearchSubParentPage {

  constructor(ref: ChangeDetectorRef, nav: NavController, private viewCtrl: ViewController, jobService: JobService, personService: PersonService, utilityService: UtilityService, navParams: NavParams, popoverController: PopoverController, events: Events, platform: Platform, alertCtrl: AlertController, loadingController: LoadingController) {
    super(ref, nav, viewCtrl, jobService, personService, utilityService, navParams, popoverController, events, platform, alertCtrl, loadingController, false, 0);
  }

searchSubParent.ts

export class SearchSubParentPage extends SearchParent {

private popoverController: PopoverController = null;

  constructor(ref: ChangeDetectorRef, nav: NavController, viewCtrl: ViewController, jobService: JobService, personService: PersonService, utilityService: UtilityService, navParams: NavParams, popoverController: PopoverController, events: Events, platform: Platform, alertCtrl: AlertController, loadingController: LoadingController, favourite: boolean, jobType: number) {
    this.popoverController = popoverController;
}

As you can see, the popoverController object is passed via the constructor to the parent SearchSubParentPage.

If I have the following line of code in SearchSubParentPage, I get the error:

this.popover = this.popoverController.create(SearchJobsPopOverPage, {...

If I comment it out, it works. So this suggests that there is something wrong with the way I pass popoverController to the parent (I have the same issue with the nav object too).

If I console.log either this.popoverController or this.nav, they appear to be fine (i.e. not undefined or null).


#2

on which version of ionic are you and what app scripts are you using?

please post the output of
ionic info


#3

Thanks for the reply. Here you go:

Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.0.0-beta.20
OS:
Node Version: v6.2.2

#4

If I make the object public, it works, not sure why.

change:

private popoverController: PopoverController = null;

to:

public popoverController: PopoverController = null;