Ionic/angular html template from a singleton/global class


#1

Using Ionic 3/Angular 5, I have a singleton class called Helper containing different functions. It also contains 3 list objects to serve my app (should be used globally).

Now I want to add a <ion-list *ngFor="let item of itemsList"> but itemsList is in the other/singleton class and not inside the current class. How can I reference it to take the values from the helper class?

For now I added to the .ts of the current class:

constructor(public navCtrl: NavController, private helper: Helper) {
    let itemsList = this.helper.itemsList;
}

and it works except it tells me in lint, that itemsList is not used. Actually I have no other use for it except for showing it in the HTML.

I also tried <ion-list *ngFor="let item of this.helper.itemsList"> but it didn’t work

Thanks


#2

Apparently changing private helper: Helper to public make the following works
<ion-list *ngFor="let item of helper.itemsList">