mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
feat(input): clearOnEdit feature. Closes #9187
This commit is contained in:
@ -160,6 +160,18 @@ export class TextInput extends InputBase {
|
||||
this._setMode(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @input {boolean} whether to clear the input upon editing or not
|
||||
*/
|
||||
@Input()
|
||||
get clearOnEdit() {
|
||||
return this._clearOnEdit;
|
||||
}
|
||||
set clearOnEdit(val: any) {
|
||||
super.setClearOnEdit(val);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@ -207,6 +219,11 @@ export class TextInput extends InputBase {
|
||||
this._item.setElementClass('item-input', true);
|
||||
this._item.registerInput(this._type);
|
||||
}
|
||||
|
||||
// By default, password inputs clear after focus when they have content
|
||||
if(this.type === 'password' && this.clearOnEdit !== false) {
|
||||
this.clearOnEdit = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user