mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
fix(input): clear text input
* Added Type Button To prevent the clear button to call submit function if ngSubmit is used. * Clear Input Action. Added a change value action to the clearTextInput function. It now actually clears input
This commit is contained in:
@ -406,6 +406,7 @@ export class InputBase {
|
|||||||
*/
|
*/
|
||||||
clearTextInput() {
|
clearTextInput() {
|
||||||
console.debug('Should clear input');
|
console.debug('Should clear input');
|
||||||
|
this._value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,7 +67,7 @@ import {Platform} from '../../platform/platform';
|
|||||||
template:
|
template:
|
||||||
'<input [type]="type" [(ngModel)]="_value" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" class="text-input">' +
|
'<input [type]="type" [(ngModel)]="_value" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" class="text-input">' +
|
||||||
'<input [type]="type" aria-hidden="true" next-input *ngIf="_useAssist">' +
|
'<input [type]="type" aria-hidden="true" next-input *ngIf="_useAssist">' +
|
||||||
'<button clear *ngIf="clearInput && value" class="text-input-clear-icon" (click)="clearTextInput()" (mousedown)="clearTextInput()"></button>' +
|
'<button clear *ngIf="clearInput && value" type="button" class="text-input-clear-icon" (click)="clearTextInput()" (mousedown)="clearTextInput()"></button>' +
|
||||||
'<div (touchstart)="pointerStart($event)" (touchend)="pointerEnd($event)" (mousedown)="pointerStart($event)" (mouseup)="pointerEnd($event)" class="input-cover" tappable *ngIf="_useAssist"></div>',
|
'<div (touchstart)="pointerStart($event)" (touchend)="pointerEnd($event)" (mousedown)="pointerStart($event)" (mouseup)="pointerEnd($event)" class="input-cover" tappable *ngIf="_useAssist"></div>',
|
||||||
directives: [
|
directives: [
|
||||||
NgIf,
|
NgIf,
|
||||||
|
Reference in New Issue
Block a user