Skip to content

Commit c57c277

Browse files
committed
Fix validation
1 parent c266e9d commit c57c277

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/RJP.MultiUrlPicker.Web.UI/MultiUrlPicker.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@
2121
$scope.$watch(function () {
2222
return this.renderModel.length
2323
}.bind(this), function () {
24-
$scope.multiUrlPickerForm.minCount.$setValidity('minCount', $scope.model.config && $scope.model.config.minNumberOfItems && +$scope.model.config.minNumberOfItems <= this.renderModel.length)
25-
$scope.multiUrlPickerForm.maxCount.$setValidity("maxCount", $scope.model.config && $scope.model.config.maxNumberOfItems && +$scope.model.config.maxNumberOfItems >= this.renderModel.length)
26-
24+
if ($scope.model.config && $scope.model.config.minNumberOfItems) {
25+
$scope.multiUrlPickerForm.minCount.$setValidity('minCount', +$scope.model.config.minNumberOfItems <= this.renderModel.length)
26+
}
27+
if ($scope.model.config && $scope.model.config.maxNumberOfItems) {
28+
$scope.multiUrlPickerForm.maxCount.$setValidity("maxCount", +$scope.model.config.maxNumberOfItems >= this.renderModel.length)
29+
}
2730
this.sortableOptions.disabled = this.renderModel.length === 1
2831
}.bind(this))
2932

0 commit comments

Comments
 (0)