-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,9 @@ angular.module('selectize', []).value('selectizeConfig', {}).directive("selectiz | |
onOptionAdd = config.onOptionAdd; | ||
|
||
config.onChange = function() { | ||
if(scope.disableOnChange) | ||
return; | ||
|
||
if (!angular.equals(selectize.items, scope.ngModel)) | ||
scope.$evalAsync(function() { | ||
var value = angular.copy(selectize.items); | ||
|
@@ -106,9 +109,11 @@ angular.module('selectize', []).value('selectizeConfig', {}).directive("selectiz | |
} | ||
|
||
scope.$watch('options', function() { | ||
scope.disableOnChange = true; | ||
selectize.clearOptions(); | ||
selectize.addOption(scope.options); | ||
selectize.setValue(scope.ngModel); | ||
scope.disableOnChange = false; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
machineboy2045
Author
Owner
|
||
}, true); | ||
|
||
scope.$watchCollection('ngModel', updateSelectize); | ||
|
Why didn't you use the 'silent' option of setValue? Seems simpler / as designed. Do I miss something (I haven't tested).