Fixes bug where selecting and deselecting users in the list was causing thes save button to be disabled improperly (#4533)

This commit is contained in:
Michael Abashian
2016-12-21 13:15:56 -05:00
committed by Jake McDermott
parent 6135056413
commit 242467cb99
2 changed files with 7 additions and 2 deletions

View File

@@ -39,7 +39,12 @@ function($scope, $rootScope, ProcessErrors, GetBasePath,
$scope.selectedItems.push(item.id); $scope.selectedItems.push(item.id);
} }
else { else {
$scope.selectedItems = _.remove($scope.selectedItems, { id: item.id }); // _.remove() Returns the new array of removed elements.
// This will pull all the values out of the array that don't
// match the deselected item effectively removing it
$scope.selectedItems = _.remove($scope.selectedItems, function(selectedItem) {
return selectedItem !== item.id;
});
} }
}); });
} }

View File

@@ -27,7 +27,7 @@
<button type="button" <button type="button"
class="btn btn-sm Form-saveButton" class="btn btn-sm Form-saveButton"
ng-click="updateUsers()" ng-click="updateUsers()"
ng-disabled="!selectedItems || !selectedItems.length"> ng-disabled="!selectedItems || selectedItems.length === 0">
Save Save
</button> </button>
</div> </div>