@Sas123 wrote:
Hi I am New to Ionic, I am following Ionic Crash Course (2.x and above) https://www.youtube.com/watch?v=O2WiI9QrS5s “Geting started Video”. to create a Basic list, But when I run my app, I get run time error. Please help below are the codes I use as instructed in the video. Thanks
My home.html
Home
<button ion-item *ngFor=“let item of items” (click)=“itemSelected(item)”>
{{ item }}
My home.ts
import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {
items: any[];
constructor(public navCtrl: NavController) {
this.items = [];
for(let 1 = 0; 1 < 10; 1++) {
this.items.push({text: 'Item ’ + i, id: 1});
}
}
itemSelected(item) {
alert(item.text);
}
}
Posts: 1
Participants: 1