Fix MNTP bounds min/max items validation

This commit is contained in:
Kenn Jacobsen
2019-04-24 22:09:00 +02:00
parent 2179e85638
commit 82f966ca24

View File

@@ -33,7 +33,6 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
/** Performs validation based on the renderModel data */
function validate() {
if ($scope.contentPickerForm) {
angularHelper.getCurrentForm($scope).$setDirty();
//Validate!
if ($scope.model.config && $scope.model.config.minNumber && parseInt($scope.model.config.minNumber) > $scope.renderModel.length) {
$scope.contentPickerForm.minCount.$setValidity("minCount", false);
@@ -65,7 +64,7 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
//model if it changes (i.e. based on server updates, or if used in split view, etc...)
$scope.$watch("model.value", function (newVal, oldVal) {
if (newVal !== oldVal) {
syncRenderModel();
syncRenderModel(true);
}
});
}
@@ -379,7 +378,7 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
}
else {
$scope.renderModel = [];
if (validate) {
if (doValidation) {
validate();
}
setSortingState($scope.renderModel);
@@ -459,6 +458,7 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
//everything is loaded, start the watch on the model
startWatch();
subscribe();
validate();
});
}