Skip to content

Commit afdb186

Browse files
committed
check scope.$root.$$phase before $apply
I used the uiSelect2 directive in another directive with isolated scope, and this modification avoid "$digest already in progress" error.
1 parent dba325b commit afdb186

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/select2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ angular.module('ui.select2', []).value('uiSelect2Config', {}).directive('uiSelec
140140
if (!isSelect) {
141141
// Set the view and model value and update the angular template manually for the ajax/multiple select2.
142142
elm.bind("change", function () {
143-
if (scope.$$phase) {
143+
if (scope.$$phase || scope.$root.$$phase) {
144144
return;
145145
}
146146
scope.$apply(function () {

0 commit comments

Comments
 (0)