From 12fc0941b7fd530e0fa5f78aa2b1654628492b1f Mon Sep 17 00:00:00 2001 From: Joan Date: Tue, 30 Oct 2018 10:52:40 +0100 Subject: [PATCH] autocomplete translate-fields property fixed --- .../src/components/autocomplete/autocomplete.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/core/src/components/autocomplete/autocomplete.js b/client/core/src/components/autocomplete/autocomplete.js index 1535080b5..a8b8ad8f3 100755 --- a/client/core/src/components/autocomplete/autocomplete.js +++ b/client/core/src/components/autocomplete/autocomplete.js @@ -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: '