diff --git a/src/scripts/directives/setting.js b/src/scripts/directives/setting.js index 9a990fd9..a4c36759 100644 --- a/src/scripts/directives/setting.js +++ b/src/scripts/directives/setting.js @@ -17,6 +17,7 @@ link: function (scope, element, attrs, ngModel) { var pendingSaveRequest = null; var options = { + showPlaceholderCount: false, deleteKeyAlwaysChangeValue: false, lazySaveTimeout: ariaNgConstants.lazySaveTimeout, errorTooltipPlacement: 'top', @@ -85,7 +86,7 @@ }; var getTotalCount = function (itemsText, separator, trim) { - if (!itemsText || !angular.isString(itemsText)) { + if (!itemsText || !separator || !angular.isString(itemsText)) { return 0; } @@ -180,6 +181,10 @@ var fixedValueCount = getTotalCount(scope.fixedValue, scope.option.separator, scope.option.trimCount); var inputValueCount = getTotalCount(scope.optionValue, scope.option.separator, scope.option.trimCount); + if (!scope.optionValue && scope.showPlaceholderCount) { + inputValueCount = scope.placeholderItemCount; + } + return fixedValueCount + inputValueCount; }; @@ -313,8 +318,10 @@ } scope.placeholder = getHumanReadableValue(displayValue); + scope.placeholderItemCount = getTotalCount(scope.placeholder, scope.option.separator, scope.option.trimCount); }); + scope.showPlaceholderCount = options.showPlaceholderCount === true || options.showPlaceholderCount === 'true'; loadHistory(); } }; diff --git a/src/views/new.html b/src/views/new.html index 56785e8d..d3472ce0 100644 --- a/src/views/new.html +++ b/src/views/new.html @@ -83,7 +83,8 @@ diff --git a/src/views/setting.html b/src/views/setting.html index 71faa37b..c9f05b14 100644 --- a/src/views/setting.html +++ b/src/views/setting.html @@ -4,7 +4,7 @@ -