Hi, I want to pass data from a parent component to a son on ionic2, I know it's done with input, but the problem is that the data is sent to me empty, using a normal angular2 application, it sends me the data without problems, but using ionic, I do not know what happens.
tabs.ts (The son)
import { Component,Input,OnInit,Directive} from '@angular/core';
@Component({
templateUrl:'tabs.html',
selector:'tabs-root',
})
export class TabsPage implements OnInit{
@Input() listaPaginas:Array<any>;
@Input() segundo:string;
// this tells the tabs component which Pages
// should be each tab's root Page
constructor() {
}
ngOnInit(){
for(let i=0;i<this.listaPaginas.length;i++){
console.log(this.listaPaginas[i]);
}
}
}
transactions.ts Father
............. ..............
@Component({
selector: 'page-transacciones-examples',
templateUrl: 'transacciones-examples.html',
})
export class TransaccionesExamplesPage {
transactions:any;
latitud:any=null;
user:string="juanito11";
cargando:Boolean=false;
longitud:any=null;
addingPage:Component=AddingPage;
listaPaginas:Array<any>=[];
constructor(public navCtrl: NavController, public navParams: NavParams) {}
ionViewWillEnter() {
this.cargando=true;
this.loadTransactions();
this.listaPaginas.push(
{component:HomePage,title:"Home",icon:"home"},
{component:AboutPage,title:"About",icon:"information-circle"},
{component:ContactPage,title:"Contacts",icon:"contacts"}
)
}
loadTransactions(){
setTimeout(()=>{
Transaction.all()
.then((os)=>{
this.transactions=os;
});
this.cargando=false;
},3000);
}
}
the html where I call the son
<tabs-root [listaPaginas]="listaPaginas" [segundo]="user"></tabs-root>
I would appreciate your help.