Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 9b8b46b

Browse files
committed
Update model on sort
1 parent 637be08 commit 9b8b46b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/uiSelectSortDirective.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
// Make multiple matches sortable
22
uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', function($timeout, uiSelectConfig, uiSelectMinErr) {
33
return {
4-
require: '^uiSelect',
5-
link: function(scope, element, attrs, $select) {
4+
require: ['^uiSelect', '^ngModel'],
5+
link: function(scope, element, attrs, ctrls) {
66
if (scope[attrs.uiSelectSort] === null) {
77
throw uiSelectMinErr('sort', "Expected a list to sort");
88
}
99

10+
var $select = ctrls[0];
11+
var $ngModel = ctrls[1];
12+
1013
var options = angular.extend({
1114
axis: 'horizontal'
1215
},
@@ -92,8 +95,8 @@ uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', f
9295
}
9396

9497
move.apply(theList, [droppedItemIndex, newIndex]);
95-
96-
scope.$parent.$selectMultiple.updateModel();
98+
99+
$ngModel.$setViewValue(Date.now());
97100

98101
scope.$apply(function() {
99102
scope.$emit('uiSelectSort:change', {

0 commit comments

Comments
 (0)