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
|
||||
*/
|
||||
export default class Autocomplete extends Input {
|
||||
constructor($element, $scope, $http, $transclude) {
|
||||
constructor($element, $scope, $http, $transclude, $translate) {
|
||||
super($element, $scope);
|
||||
this.$http = $http;
|
||||
this.$transclude = $transclude;
|
||||
|
||||
this.$translate = $translate;
|
||||
this._field = undefined;
|
||||
this._selection = null;
|
||||
this.readonly = true;
|
||||
|
@ -191,6 +191,12 @@ export default class Autocomplete extends Input {
|
|||
}
|
||||
|
||||
this.input.value = display;
|
||||
|
||||
if (this.translateFields) {
|
||||
if (this.translateFields.indexOf(this.showField) > -1)
|
||||
this.input.value = this.$translate.instant(display);
|
||||
}
|
||||
|
||||
this.mdlUpdate();
|
||||
}
|
||||
|
||||
|
@ -269,7 +275,7 @@ export default class Autocomplete extends Input {
|
|||
this.$.dropDown.show(this.input, search);
|
||||
}
|
||||
}
|
||||
Autocomplete.$inject = ['$element', '$scope', '$http', '$transclude'];
|
||||
Autocomplete.$inject = ['$element', '$scope', '$http', '$transclude', '$translate'];
|
||||
|
||||
ngModule.component('vnAutocomplete', {
|
||||
template: require('./autocomplete.html'),
|
||||
|
@ -291,6 +297,7 @@ ngModule.component('vnAutocomplete', {
|
|||
where: '<?',
|
||||
order: '@?',
|
||||
limit: '<?',
|
||||
translateFields: '<?',
|
||||
searchFunction: '&?'
|
||||
},
|
||||
transclude: {
|
||||
|
|
Loading…
Reference in New Issue