I am following the ionic tutorial here however the code listed in this section is different to the code which is currently in the latest tutorial template which is downloaded when I run the CLI command: ionic start MyIonic2Project tutori --v2
Any advice? I was an ionic 1 developer but I am really struggling to migrate.
import {Component} from “@angular/core”;
import {NavController, NavParams} from ‘ionic-angular’;
import {ItemDetailsPage} from ‘…/item-details/item-details’;
@Component({
templateUrl: ‘build/pages/list/list.html’
})
export class ListPage {
// provide Angular with metadata about things it should inject in the constructor
static get parameters() {
return [[NavController], [NavParams]];
}
constructor(nav, navParams) {
this.nav = nav;
// If we navigated to this page, we will have an item available as a nav param this.selectedItem = navParams.get('item');
this.icons = ['flask', 'wifi', 'beer', 'football', 'basketball', 'paper-plane', 'american-football', 'boat', 'bluetooth', 'build'];
this.items = []; for(let i = 1; i < 11; i++) { this.items.push({ title: 'Item ' + i, note: 'This is item #' + i, icon: this.icons[Math.floor(Math.random() * this.icons.length)] }); }
}
itemTapped(event, item) {
this.nav.push(ItemDetailsPage, {
item: item
});
}
}