From a689a38f19f189c1cc33ea56df5a31cf32d9246a Mon Sep 17 00:00:00 2001 From: Bobby Kerstan Date: Thu, 18 Aug 2016 14:31:33 -0400 Subject: [PATCH 1/2] Added scope watching to update select options if they change or added after page load. --- src/multiselect.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/multiselect.js b/src/multiselect.js index a4a4dde..55e4aa0 100644 --- a/src/multiselect.js +++ b/src/multiselect.js @@ -84,6 +84,12 @@ } }; + // Update selection options if data changes + $scope.$watch('options', function(newVal, oldVal) { + $scope.options = newVal; + updateSelectionLists(); + }, true); + $ngModelCtrl.$render = function () { updateSelectionLists(); }; From d4a8aa5ec63ec3a5ef969e779b961286a23c647c Mon Sep 17 00:00:00 2001 From: Bobby Kerstan Date: Thu, 18 Aug 2016 15:11:30 -0400 Subject: [PATCH 2/2] Add resolved options to watch. --- src/multiselect.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/multiselect.js b/src/multiselect.js index 55e4aa0..4dd62df 100644 --- a/src/multiselect.js +++ b/src/multiselect.js @@ -85,8 +85,9 @@ }; // Update selection options if data changes - $scope.$watch('options', function(newVal, oldVal) { + $scope.$watch('options', function(newVal) { $scope.options = newVal; + $scope.resolvedOptions = newVal; updateSelectionLists(); }, true);