Added null-check before updating the count. (#5142)

This commit is contained in:
Bjarke Berg
2019-04-03 13:35:01 +02:00
committed by Niels Lyngsø
parent a0f5a466ac
commit 74bfaabf90

View File

@@ -4,7 +4,7 @@ function textboxController($scope) {
if (!$scope.model.config) {
$scope.model.config = {};
}
$scope.model.count = 0;
if (!$scope.model.config.maxChars) {
// 500 is the maximum number that can be stored
// in the database, so set it to the max, even
@@ -13,7 +13,9 @@ function textboxController($scope) {
}
$scope.model.change = function () {
$scope.model.count = $scope.model.value.length;
if ($scope.model.value) {
$scope.model.count = $scope.model.value.length;
}
}
$scope.model.change();