i want to pass an array of objects and to arrange it into the next page in order of pasillo, the objects with pasillo 1 in the ion list 1 and so on. Im kinda new to ionic2 and i can't figure how to, I tried to make it with ng-hide but no luck, if you could help me i would be more than thankful. The error I'm getting right now is that listaRdy[i].pasillo in undefined. listaRdy{name:string,pasillo:number,id:string}
typescript file:
import { Component } from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-lista-ready',
templateUrl: 'lista-ready.html',
})
export class ListaReadyPage {
listaRdy:{name:string,pasillo:number,id:string}[];
pasillo1=false;
pasillo2=false;
pasillo3=false;
pasillo4=false;
pasillo5=false;
pasillo6=false;
pasillo7=false;
pasillo8=false;
pasillo9=false;
pasillo10=false;
pasillo11=false;
pasillo12=false;
pasillo13=false;
pasillo14=false;
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.listaRdy=this.navParams.data;
}
ionViewWillEnter(){
for(var i=0; this.listaRdy.length;i++) {
if (this.listaRdy[i].pasillo == 1) {
this.pasillo1 = true;
}
if (this.listaRdy[i].pasillo == 2) {
this.pasillo2 = true;
}
if (this.listaRdy[i].pasillo == 3) {
this.pasillo3 = true;
}
if (this.listaRdy[i].pasillo == 4) {
this.pasillo4 = true;
}
if (this.listaRdy[i].pasillo == 5) {
this.pasillo5 = true;
}
if (this.listaRdy[i].pasillo == 6) {
this.pasillo6 = true;
}
if (this.listaRdy[i].pasillo == 7) {
this.pasillo7 = true;
}
if (this.listaRdy[i].pasillo == 8) {
this.pasillo8 = true;
}
if (this.listaRdy[i].pasillo == 9) {
this.pasillo9 = true;
}
if (this.listaRdy[i].pasillo == 10) {
this.pasillo10 = true;
}
if (this.listaRdy[i].pasillo == 11) {
this.pasillo11 = true;
}
if (this.listaRdy[i].pasillo == 12) {
this.pasillo12 = true;
}
if (this.listaRdy[i].pasillo == 13) {
this.pasillo13 = true;
}
if (this.listaRdy[i].pasillo == 14) {
this.pasillo14 = true;
}
}
}
}
htmlFile:
<ion-header>
<ion-navbar>
<ion-title>listaReady</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<ion-list>
<ion-list-header ng-hide="pasillo1==false" >Pasillo 1</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-hide="pasillo2==false" >Pasillo 2</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo3==true" >Pasillo 3</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo4==true" >Pasillo 4</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo5==true" >Pasillo 5</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo6==true" >Pasillo 6</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo7==true" >Pasillo 7</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo8==true" >Pasillo 8</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo9==true" >Pasillo 9</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo10==true" >Pasillo 10</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo11==true" >Pasillo 11</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo12==true" >Pasillo 12</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo13==true" >Pasillo 13</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header ng-show="pasillo14==true" >Pasillo 14</ion-list-header>
</ion-list>
</ion-content>