autocomplete translate-fields property fixed
This commit is contained in:
parent
3ab11cffc5
commit
12fc0941b7
|
@ -15,11 +15,11 @@ import './style.scss';
|
||||||
* @event change Thrown when value is changed
|
* @event change Thrown when value is changed
|
||||||
*/
|
*/
|
||||||
export default class Autocomplete extends Input {
|
export default class Autocomplete extends Input {
|
||||||
constructor($element, $scope, $http, $transclude) {
|
constructor($element, $scope, $http, $transclude, $translate) {
|
||||||
super($element, $scope);
|
super($element, $scope);
|
||||||
this.$http = $http;
|
this.$http = $http;
|
||||||
this.$transclude = $transclude;
|
this.$transclude = $transclude;
|
||||||
|
this.$translate = $translate;
|
||||||
this._field = undefined;
|
this._field = undefined;
|
||||||
this._selection = null;
|
this._selection = null;
|
||||||
this.readonly = true;
|
this.readonly = true;
|
||||||
|
@ -191,6 +191,12 @@ export default class Autocomplete extends Input {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.input.value = display;
|
this.input.value = display;
|
||||||
|
|
||||||
|
if (this.translateFields) {
|
||||||
|
if (this.translateFields.indexOf(this.showField) > -1)
|
||||||
|
this.input.value = this.$translate.instant(display);
|
||||||
|
}
|
||||||
|
|
||||||
this.mdlUpdate();
|
this.mdlUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +275,7 @@ export default class Autocomplete extends Input {
|
||||||
this.$.dropDown.show(this.input, search);
|
this.$.dropDown.show(this.input, search);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Autocomplete.$inject = ['$element', '$scope', '$http', '$transclude'];
|
Autocomplete.$inject = ['$element', '$scope', '$http', '$transclude', '$translate'];
|
||||||
|
|
||||||
ngModule.component('vnAutocomplete', {
|
ngModule.component('vnAutocomplete', {
|
||||||
template: require('./autocomplete.html'),
|
template: require('./autocomplete.html'),
|
||||||
|
@ -291,6 +297,7 @@ ngModule.component('vnAutocomplete', {
|
||||||
where: '<?',
|
where: '<?',
|
||||||
order: '@?',
|
order: '@?',
|
||||||
limit: '<?',
|
limit: '<?',
|
||||||
|
translateFields: '<?',
|
||||||
searchFunction: '&?'
|
searchFunction: '&?'
|
||||||
},
|
},
|
||||||
transclude: {
|
transclude: {
|
||||||
|
|
Loading…
Reference in New Issue