Cordova Yardımı Lazım
-
<ion-header> <ion-navbar> <ion-title> Searchbars </ion-title> </ion-navbar> </ion-header> <ion-content> <ion-searchbar (ionInput)="getItems($event)"></ion-searchbar> <ion-list> <ion-item *ngFor="let item of items"> {{ item }} </ion-item> </ion-list> </ion-content>
import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; @Component({ selector: 'page-home', templateUrl: 'home.html' }) export class HomePage { items; constructor(public navCtrl: NavController) { } initializeItems() { this.items = [ 'Amsterdam', 'Bogota', ]; } getItems(ev) { // Reset items back to all of the items this.initializeItems(); // set val to the value of the ev target var val = ev.target.value; // if the value is an empty string don't filter the items if (val && val.trim() != '') { this.items = this.items.filter((item) => { return (item.toLowerCase().indexOf(val.toLowerCase()) > -1); }) } } }
Amacım arama yaptıktan sonra çıkan sonuca tıklayıp yeni sayfa açılması fakat ne yaptıysam da tıklanılabilir birşey gibi gösteremedim.
Kısaca Amsterdam'a tıkladığım zaman yeni sayfa açılması yardımcı olabilir misiniz ?
-
Ben anlamam ama bir Upping gelir elimden.
-
1.detail sayfasini terminalden aciyoruz.
$ ionic generate page detail
2. src/app/app.component.ts dosyasina componenti ekliyoruz.import { DetailPage } from '../pages/detail/detail'
3. src/app/app.module.ts modulu ekliyor ve tanimlatiyoruz.
import { DetailPage } from '../pages/detail/detail'
@NgModule({
declarations: [
DetailPage
], entryComponents: [
DetailPage
],
4. Liste.ts detail sayfasina baglanti yapmak icin import ediyoruz.import { DetailPage } from '../detail/detail'
5. Liste.ts click oldugunda calisacak kodu ekliyoruz.
// amsterdam'a tikladiginda.
itemTapped(event, item) {
this.navCtrl.push(DetailPage, {
item: item
});
}6. Liste.html click func ekliyoruz.
<ion-content> <ion-searchbar (ionInput)="getItems($event)"></ion-searchbar> <ion-list> <ion-item *ngFor="let item of items"(click)="itemTapped($event, item)"> {{ item }} </ion-item> </ion-list> </ion-content>