From 97c200809804d5292baade3560d46035f6ce7b8f Mon Sep 17 00:00:00 2001 From: Nikhil13x Date: Sun, 1 Oct 2017 11:26:01 +0530 Subject: [PATCH] header not updating when change option specified- fix --- src/multiselect.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/multiselect.js b/src/multiselect.js index bf57161..69635a2 100644 --- a/src/multiselect.js +++ b/src/multiselect.js @@ -91,6 +91,7 @@ angular.module('am.multiselect', []) scope.$watch(function () { return modelCtrl.$modelValue; }, function (newVal, oldVal) { + getHeaderText(); // when directive initialize, newVal usually undefined. Also, if model value already set in the controller // for preselected list then we need to mark checked in our scope item. But we don't want to do this every time // model changes. We need to do this only if it is done outside directive scope, from controller, for example. @@ -98,7 +99,7 @@ angular.module('am.multiselect', []) markChecked(newVal); scope.$eval(changeHandler); } - getHeaderText(); + modelCtrl.$setValidity('required', scope.valid()); }, true);