I am a noob here, but I need some of help, I am doing a Ionic 2 aplication and this is about search, so i have a main template which i will insert a new template with result's, so i got problem fot to pass the search key from de main template to the result template, i was trying with the @Input but I am a noob, and I want learn,I would greatly appreciate your help...
This is the main code App.html my variable is "prueba":
<div id="sbar">
<ion-searchbar id="searchbox" (keyup)='upkey($event)' (keydown)='downkey($event)' [recibir]="prueba" //here i declare the bindding variables></ion-searchbar>
</div>
this is my App.js code where i assign the search key:
class MyApp {
constructor(app: IonicApp, platform: Platform, http: Http) {
this.app = app;
this.platform = platform;
this.http=http;
this.prueba = "Search_Key"; //my variable
this.Leyes = [];
this.url = 'http://##########/resultados.json?q=';
this.initializeApp();
this.pages = [
{ imagen: 'build/img/home.png', title: 'Home', component: GettingStartedPage },
{ imagen: 'build/img/info38.png', title: 'Ayuda', component: AyudaHTML },
{ imagen: 'build/img/faq7.png', title: 'Preguntas Frecuentes', component: FaqHTML }
{ imagen: 'build/img/cloud158.png', title: 'Actualizaciones', component: ActualizacionesHTML },
{ imagen: 'build/img/news29.png', title: 'Novedades', component: NovedadesHTML },
{ imagen: 'build/img/two205.png', title: '¿Te gustaría colaborar?', component: ColaborarHTML },
{ imagen: 'build/img/multiple25.png', title: 'Acerca', component: AcercaHTML},
];
this.rootPage = GettingStartedPage;
}
initializeApp() {
this.platform.ready().then(() => {
});
}
And this is the other template where I receive the Input with the name "recibir":
export class GettingStartedPage{
@Input() recibir;//this the Search_key that I receive
constructor(app: IonicApp,http: Http) {
this.http=http;
this.Leyes = [];
this.url = 'http://www.##########/resultados.json?q=';
alert("Recibira :" + this.recibir);
this.buscar(this.recibir);
}
}
Please help me...it doesn't work i don't know why