mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 05:58:26 +08:00
test(input): adds events test
This commit is contained in:
63
src/components/input/test/events/app-module.ts
Normal file
63
src/components/input/test/events/app-module.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { IonicApp, IonicModule, TextInput } from '../../../..';
|
||||
|
||||
|
||||
@Component({
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
export class E2EPage {
|
||||
ngvalue1: any;
|
||||
ngvalue2: any;
|
||||
value2: any;
|
||||
value3: any;
|
||||
value4: any;
|
||||
value5: any;
|
||||
value6: any;
|
||||
|
||||
input2() {
|
||||
this.value2 = this.ngvalue2;
|
||||
console.log('value2', this.value2);
|
||||
}
|
||||
|
||||
input3(ref: TextInput) {
|
||||
this.value3 = ref.value;
|
||||
console.log('value3', this.value3);
|
||||
}
|
||||
|
||||
input4(value: string) {
|
||||
this.value4 = value;
|
||||
console.log('value4', this.value4);
|
||||
}
|
||||
|
||||
input5(ev: any) {
|
||||
this.value5 = ev.target.value;
|
||||
console.log('value5', this.value5);
|
||||
}
|
||||
|
||||
input6(value: string) {
|
||||
this.value6 = value;
|
||||
console.log('value6', this.value6);
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
template: '<ion-nav [root]="rootPage"></ion-nav>'
|
||||
})
|
||||
export class E2EApp {
|
||||
rootPage = E2EPage;
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
E2EApp,
|
||||
E2EPage
|
||||
],
|
||||
imports: [
|
||||
IonicModule.forRoot(E2EApp)
|
||||
],
|
||||
bootstrap: [IonicApp],
|
||||
entryComponents: [
|
||||
E2EPage
|
||||
]
|
||||
})
|
||||
export class AppModule {}
|
1
src/components/input/test/events/e2e.ts
Normal file
1
src/components/input/test/events/e2e.ts
Normal file
@ -0,0 +1 @@
|
||||
|
50
src/components/input/test/events/main.html
Normal file
50
src/components/input/test/events/main.html
Normal file
@ -0,0 +1,50 @@
|
||||
<ion-header>
|
||||
|
||||
<ion-toolbar>
|
||||
<ion-title>Inline Label Text Input</ion-title>
|
||||
</ion-toolbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content>
|
||||
<ion-list>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>NgModel: {{ngvalue1}}</ion-label>
|
||||
<ion-input [(ngModel)]="ngvalue1"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>#Reference.value: {{inputRef0.value}}</ion-label>
|
||||
<ion-input #inputRef0></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>NgModel + (input): {{value2}}</ion-label>
|
||||
<ion-input [(ngModel)]="ngvalue2" (input)="input2()"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>#Reference + (input): {{value3}}</ion-label>
|
||||
<ion-input #inputRef1 (input)="input3(inputRef1)"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>#Reference.value + (input): {{value4}}</ion-label>
|
||||
<ion-input #inputRef2 (input)="input4(inputRef2.value)"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>(input) + event: {{value5}}</ion-label>
|
||||
<ion-input (input)="input5($event)"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>(input) + event.target.value: {{value6}}</ion-label>
|
||||
<ion-input (input)="input6($event.target.value)"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
</ion-list>
|
||||
|
||||
</ion-content>
|
Reference in New Issue
Block a user