Make sure the $scope.canAddCollaborators var is initialised at least once, outside of angular $watch.

This commit is contained in:
Shane Kilkelly 2016-11-07 14:36:04 +00:00
parent 0b50623d51
commit 2ff211ce2c

View file

@ -19,11 +19,16 @@ define [
, 200 , 200
INFINITE_COLLABORATORS = -1 INFINITE_COLLABORATORS = -1
$scope.$watch "(project.members.length + project.invites.length)", (noOfMembers) ->
allowedNoOfMembers = $scope.project.features.collaborators
$scope.canAddCollaborators = noOfMembers < allowedNoOfMembers or allowedNoOfMembers == INFINITE_COLLABORATORS
window._m = projectMembers $scope.refreshCanAddCollaborators = () ->
allowedNoOfMembers = $scope.project.features.collaborators
$scope.canAddCollaborators = (
($scope.project.members.length + $scope.project.invites.length) < allowedNoOfMembers or allowedNoOfMembers == INFINITE_COLLABORATORS
)
$scope.refreshCanAddCollaborators()
$scope.$watch "(project.members.length + project.invites.length)", (_noOfMembers) ->
$scope.refreshCanAddCollaborators()
$scope.autocompleteContacts = [] $scope.autocompleteContacts = []
do loadAutocompleteUsers = () -> do loadAutocompleteUsers = () ->