From a125d41d2fed67faca048aaf47c1f83f30d92ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 25 Oct 2018 16:06:43 +0200 Subject: [PATCH] Fix function apply, better no value --- contribs/gmf/src/raster/component.js | 14 +++++++++++--- contribs/gmf/src/raster/widgetComponent.html | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/contribs/gmf/src/raster/component.js b/contribs/gmf/src/raster/component.js index 5441b96989ed..35529b1cc875 100644 --- a/contribs/gmf/src/raster/component.js +++ b/contribs/gmf/src/raster/component.js @@ -127,13 +127,14 @@ exports.directive('gmfElevation', exports.component_); * @param {!angular.$filter} $filter Angular filter. * @param {!ngeox.miscDebounce} ngeoDebounce Ngeo debounce factory * @param {!gmf.raster.RasterService} gmfRaster Gmf Raster service + * @param {!angularGettext.Catalog} gettextCatalog Gettext catalog. * @constructor * @private * @ngInject * @ngdoc controller * @ngname gmfElevationController */ -exports.Controller_ = function($scope, $filter, ngeoDebounce, gmfRaster) { +exports.Controller_ = function($scope, $filter, ngeoDebounce, gmfRaster, gettextCatalog) { /** * @type {!angular.$filter} @@ -153,6 +154,12 @@ exports.Controller_ = function($scope, $filter, ngeoDebounce, gmfRaster) { */ this.gmfRaster_ = gmfRaster; + /** + * @type {angularGettext.Catalog} + * @private + */ + this.gettextCatalog = gettextCatalog; + /** * @type {!Object.} * @private @@ -281,9 +288,10 @@ exports.Controller_.prototype.getRasterSuccess_ = function(resp) { const separator = postfix.length > 0 ? (options.hasOwnProperty('separator') ? options.separator : '\u00a0') : ''; const args = Array.prototype.concat([value], custom_args); - this.elevation = this.filter_(filter).apply(args) + separator + postfix; + this.elevation = this.filter_(filter)(...args) + separator + postfix; } else { - this.elevation = undefined; + const gettextCatalog = this.gettextCatalog; + this.elevation = gettextCatalog.getString('No value'); } this.loading = false; }; diff --git a/contribs/gmf/src/raster/widgetComponent.html b/contribs/gmf/src/raster/widgetComponent.html index 58b2eb7c078f..43a080891cb8 100644 --- a/contribs/gmf/src/raster/widgetComponent.html +++ b/contribs/gmf/src/raster/widgetComponent.html @@ -13,7 +13,7 @@ {{ctrl.elevationValue}} - Elevation… + Elevation…