Hi there, I'm currently learning Ionic 2 and I recently created an array that I want to loop through in an ion-list.
This is my produk.ts
import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
@Component({
selector: 'page-produk',
templateUrl: 'produk.html',
})
export class ProdukPage {
constructor(public navCtrl: NavController, public navParams: NavParams) {
var menu: any[] = [
"menu 1",
"menu 2",
"menu 3"
];
}
}
I attempted using the following code in my HTML file, but unfortunately, it did not work as expected.
<ion-content padding>
<ion-list>
<ion-item *ngfor="let item of menu">
{{menu}}
</ion-item>
</ion-list>
</ion-content>