scope on collaborator-removed function event collaborator scope collab

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
$scope.$on('collaborator-removed', function (event, collaborator){
$scope.collaborators.$promise.then(function (){
var index = $scope.collaborators.indexOf(collaborator);
$scope.collaborators.splice(index, 1);
});
});
$scope.$on('collaborator-created', function (event, collaborator){
$scope.collaborators.$promise.then(function (){
$scope.collaborators.push(collaborator);
})
});
$scope.remove = function (collaborator){
Collaborators.delete(collaborator);
$scope.$parent.$broadcast('collaborator-removed', collaborator);
};
$scope.shared = function (collaborator){
console.debug(collaborator);
$scope.$parent.$broadcast('collaborator-created', collaborator);
};