Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit d8fa639

Browse files
committed
Merge branch 'waitForNotDisabled0.14' of https://github.com/michaschwab/ui-sortable into michaschwab-waitForNotDisabled0.14
2 parents 5d540af + ec6567f commit d8fa639

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/sortable.js

+21-2
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,27 @@ angular.module('ui.sortable', [])
448448
$log.info('ui.sortable: ngModel not provided!', element);
449449
}
450450

451-
// Create sortable
452-
element.sortable(opts);
451+
var stopDisabledWatcher = angular.noop;
452+
453+
var startIfEnabled = function()
454+
{
455+
if(!scope.uiSortable.disabled)
456+
{
457+
// Create sortable
458+
element.sortable(opts);
459+
460+
// Stop Watcher
461+
stopDisabledWatcher();
462+
463+
return true;
464+
}
465+
return false;
466+
};
467+
468+
if(!startIfEnabled())
469+
{
470+
stopDisabledWatcher = scope.$watch('uiSortable.disabled', startIfEnabled);
471+
}
453472
}
454473
};
455474
}

0 commit comments

Comments
 (0)