mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(input): show clear-input on inputs with ngModel/formControlName
fixes #9077
This commit is contained in:
committed by
Adam Bradley
parent
2ee05b878c
commit
7a6ba2d300
@@ -301,6 +301,7 @@ export class TextInput extends Ion implements IonicFormInput {
|
||||
|
||||
nativeInput.valueChange.subscribe((inputValue: any) => {
|
||||
this.onChange(inputValue);
|
||||
this.checkHasValue(inputValue);
|
||||
});
|
||||
|
||||
nativeInput.keydown.subscribe((inputValue: any) => {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { FormBuilder, Validators } from '@angular/forms';
|
||||
|
||||
import { IonicApp, IonicModule } from '../../../../../ionic-angular';
|
||||
|
||||
|
||||
@@ -6,8 +8,16 @@ import { IonicApp, IonicModule } from '../../../../../ionic-angular';
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
export class E2EPage {
|
||||
userForm: any;
|
||||
myValue = 'really long value that overflows to show padding';
|
||||
|
||||
constructor(fb: FormBuilder) {
|
||||
this.userForm = fb.group({
|
||||
username: [{value: '', disabled: false}, Validators.required],
|
||||
password: [{value: '', disabled: false}, Validators.required],
|
||||
});
|
||||
}
|
||||
|
||||
clicked() {
|
||||
console.log('clicked button');
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
<ion-input class="e2eClearInput" [(ngModel)]="myValue"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Input Clear No ngModel:</ion-label>
|
||||
<ion-input clearInput></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Input Clear:</ion-label>
|
||||
<ion-input class="e2eClearInput" [(ngModel)]="myValue" clearInput></ion-input>
|
||||
@@ -33,4 +38,20 @@
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
|
||||
<form [formGroup]="userForm">
|
||||
<ion-list>
|
||||
<ion-list-header>
|
||||
Form w/ clearInput
|
||||
</ion-list-header>
|
||||
<ion-item>
|
||||
<ion-label floating>Username</ion-label>
|
||||
<ion-input formControlName="username" clearInput></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label floating>Password</ion-label>
|
||||
<ion-input type="password" formControlName="password" clearInput></ion-input>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</form>
|
||||
|
||||
</ion-content>
|
||||
|
||||
Reference in New Issue
Block a user