So I have a page called home which has several lists.
Lists were created using this code
ion-content>
<ion-list>
<button ion-item *ngFor="let item of items" (click)="itemSelected(item)">
{{ item.text }}
</button>
</ion-list>
</ion-content>
That code was in home.html
Then code in home.ts
constructor(public navCtrl: NavController) {
this.navCtrl=navCtrl;
this.items = [];
this.universities=[];
for (let i = 0; i<10; i++ ){
this.universities.push(i);
this.items.push({
text: 'University ' + (i+1),
id: (i+1)
});
}
}
itemSelected(item){
this.navCtrl.push(CoursesPage,{item:item});// unis:this.universities});
Now I need to create a similar list in the page courses. This page was added properly as the list in home links to the courses page. But I need lists in courses too. This has been done but the list does not show up.
Courses.html
<ion-header>
<ion-navbar color="primary">
<ion-title>{{item.text}}</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<ion-list>
<button ion-item *ngFor="let item of items" (click)="itemSelected1(item1)">
{{ item1.text }}
</button>
</ion-list>
</ion-content>
courses.ts
export class CoursesPage {
unis: any;
item:any;
courses1:any[];
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.item=navParams.get('item');
//this.unis=navParams.get('unis');
this.courses1=[];
for(let j = 0; j<10; j++){
this.courses1.push(
{text: 'Course' + (j+1),
id: (j+1)
});
}
}
ionViewDidLoad() {
console.log('ionViewDidLoad CoursesPage');
}
itemSelected1(item1){
alert(item1.text);
}
}
I am a beginner to IONIC and Im trying to create a MVP for one of my projects.
Thanks in advance. The problem: List doesnt show up in courses page.