mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
Misc 4
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Component, ElementRef, EventEmitter, HostBinding, Input, Optional, Output, Renderer, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, ElementRef, EventEmitter, Input, Optional, Output, Renderer, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { NgControl } from '@angular/forms';
|
||||
|
||||
import { Config } from '../../config/config';
|
||||
@ -287,6 +287,7 @@ export class Searchbar extends BaseInput<string> {
|
||||
* Update the Searchbar input value when the input changes
|
||||
*/
|
||||
inputChanged(ev: any) {
|
||||
this.ionInput.emit(ev);
|
||||
this.value = ev.target.value;
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<ion-header>
|
||||
|
||||
<ion-navbar>
|
||||
<ion-searchbar color="primary" autofocus (ionInput)="getItems($event)" placeholder="Filter Schedules">
|
||||
<ion-searchbar color="primary" autofocus (ionChange)="getItems($event.value)" placeholder="Filter Schedules">
|
||||
</ion-searchbar>
|
||||
</ion-navbar>
|
||||
|
||||
@ -15,9 +15,9 @@
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
|
||||
<ion-input [(ngModel)]="value"></ion-input>
|
||||
<form>
|
||||
<ion-searchbar (ionInput)="getItems($event)"></ion-searchbar>
|
||||
<ion-searchbar [(ngModel)]="value" (ionChange)="getItems($event.value)" name="search"></ion-searchbar>
|
||||
</form>
|
||||
<ion-list>
|
||||
<button ion-item *ngFor="let item of items" (click)="showDetail(item)" class="e2eSearchbarNavItem">
|
||||
|
||||
@ -7,6 +7,7 @@ import { IonicPage, NavController, ModalController } from '../../../../../..';
|
||||
})
|
||||
export class SearchPage {
|
||||
items: string[];
|
||||
value = '';
|
||||
|
||||
constructor(public navCtrl: NavController, public modalCtrl: ModalController) {
|
||||
this.initializeItems();
|
||||
@ -58,13 +59,10 @@ export class SearchPage {
|
||||
];
|
||||
}
|
||||
|
||||
getItems(ev: any) {
|
||||
getItems(q: string) {
|
||||
// Reset items back to all of the items
|
||||
this.initializeItems();
|
||||
|
||||
// set q to the value of the searchbar
|
||||
var q = ev.value;
|
||||
|
||||
// if the value is an empty string don't filter the items
|
||||
if (!q || q.trim() === '') {
|
||||
return;
|
||||
|
||||
@ -6,6 +6,7 @@ import { pointerCoord } from './dom';
|
||||
|
||||
|
||||
export class ScrollView {
|
||||
|
||||
ev: ScrollEvent;
|
||||
isScrolling = false;
|
||||
onScrollStart: (ev: ScrollEvent) => void;
|
||||
@ -23,7 +24,6 @@ export class ScrollView {
|
||||
private _lsn: Function;
|
||||
private _endTmr: Function;
|
||||
|
||||
|
||||
constructor(
|
||||
private _plt: Platform,
|
||||
private _dom: DomController,
|
||||
|
||||
Reference in New Issue
Block a user