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 { NgControl } from '@angular/forms';
|
||||||
|
|
||||||
import { Config } from '../../config/config';
|
import { Config } from '../../config/config';
|
||||||
@ -287,6 +287,7 @@ export class Searchbar extends BaseInput<string> {
|
|||||||
* Update the Searchbar input value when the input changes
|
* Update the Searchbar input value when the input changes
|
||||||
*/
|
*/
|
||||||
inputChanged(ev: any) {
|
inputChanged(ev: any) {
|
||||||
|
this.ionInput.emit(ev);
|
||||||
this.value = ev.target.value;
|
this.value = ev.target.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
|
|
||||||
<ion-navbar>
|
<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-searchbar>
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
|
|
||||||
@ -15,9 +15,9 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
<ion-input [(ngModel)]="value"></ion-input>
|
||||||
<form>
|
<form>
|
||||||
<ion-searchbar (ionInput)="getItems($event)"></ion-searchbar>
|
<ion-searchbar [(ngModel)]="value" (ionChange)="getItems($event.value)" name="search"></ion-searchbar>
|
||||||
</form>
|
</form>
|
||||||
<ion-list>
|
<ion-list>
|
||||||
<button ion-item *ngFor="let item of items" (click)="showDetail(item)" class="e2eSearchbarNavItem">
|
<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 {
|
export class SearchPage {
|
||||||
items: string[];
|
items: string[];
|
||||||
|
value = '';
|
||||||
|
|
||||||
constructor(public navCtrl: NavController, public modalCtrl: ModalController) {
|
constructor(public navCtrl: NavController, public modalCtrl: ModalController) {
|
||||||
this.initializeItems();
|
this.initializeItems();
|
||||||
@ -58,13 +59,10 @@ export class SearchPage {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getItems(ev: any) {
|
getItems(q: string) {
|
||||||
// Reset items back to all of the items
|
// Reset items back to all of the items
|
||||||
this.initializeItems();
|
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 the value is an empty string don't filter the items
|
||||||
if (!q || q.trim() === '') {
|
if (!q || q.trim() === '') {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { pointerCoord } from './dom';
|
|||||||
|
|
||||||
|
|
||||||
export class ScrollView {
|
export class ScrollView {
|
||||||
|
|
||||||
ev: ScrollEvent;
|
ev: ScrollEvent;
|
||||||
isScrolling = false;
|
isScrolling = false;
|
||||||
onScrollStart: (ev: ScrollEvent) => void;
|
onScrollStart: (ev: ScrollEvent) => void;
|
||||||
@ -23,7 +24,6 @@ export class ScrollView {
|
|||||||
private _lsn: Function;
|
private _lsn: Function;
|
||||||
private _endTmr: Function;
|
private _endTmr: Function;
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _plt: Platform,
|
private _plt: Platform,
|
||||||
private _dom: DomController,
|
private _dom: DomController,
|
||||||
|
|||||||
Reference in New Issue
Block a user