Added autocomplete property

This commit is contained in:
Joan Sanchez 2020-03-10 14:28:50 +01:00
parent b214de25ce
commit 3c88a25c2a
3 changed files with 14 additions and 2 deletions

View File

@ -23,7 +23,6 @@ export default class Autocomplete extends Field {
this._selection = null;
this.input = this.element.querySelector('input');
this.input.setAttribute('autocomplete', 'off');
}
$postLink() {

View File

@ -3,7 +3,8 @@
ng-model="$ctrl.search"
class="dense search"
ng-blur="$ctrl.onFocusOut()"
placeholder="{{::'Search' | translate}}">
placeholder="{{::'Search' | translate}}"
autocomplete="off">
</vn-textfield>
</div>
<div class="list" tabindex="-1">

View File

@ -132,6 +132,17 @@ export default class Field extends FormInput {
return this.error || this.inputError || null;
}
get autocomplete() {
return this._autocomplete;
}
set autocomplete(value) {
this._autocomplete = value;
console.log(value);
if (value === 'off')
this.input.setAttribute('autocomplete', 'off');
}
refreshHint() {
let error = this.shownError;
let hint = error || this.hint;
@ -206,6 +217,7 @@ ngModule.vnComponent('vnField', {
controller: Field,
bindings: {
type: '@?',
autocomplete: '@?',
placeholder: '@?',
value: '=?',
info: '@?',