Skip to content

Commit bde103d

Browse files
Pekes317adamdbradley
authored andcommitted
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
1 parent 9d4ded1 commit bde103d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

ionic/components/input/input-base.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ export class InputBase {
406406
*/
407407
clearTextInput() {
408408
console.debug('Should clear input');
409+
this._value = '';
409410
}
410411

411412
/**

ionic/components/input/input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import {Platform} from '../../platform/platform';
6767
template:
6868
'<input [type]="type" [(ngModel)]="_value" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" class="text-input">' +
6969
'<input [type]="type" aria-hidden="true" next-input *ngIf="_useAssist">' +
70-
'<button clear *ngIf="clearInput && value" class="text-input-clear-icon" (click)="clearTextInput()" (mousedown)="clearTextInput()"></button>' +
70+
'<button clear *ngIf="clearInput && value" type="button" class="text-input-clear-icon" (click)="clearTextInput()" (mousedown)="clearTextInput()"></button>' +
7171
'<div (touchstart)="pointerStart($event)" (touchend)="pointerEnd($event)" (mousedown)="pointerStart($event)" (mouseup)="pointerEnd($event)" class="input-cover" tappable *ngIf="_useAssist"></div>',
7272
directives: [
7373
NgIf,

0 commit comments

Comments
 (0)