Fixed issue with selected users based on user.id rathr than set index. Fixed dataLoad callback not being destroyed after controller routine exits.

This commit is contained in:
Chris Houseknecht
2013-05-06 22:18:44 -04:00
parent ccb732bd69
commit ced96a1bb3
8 changed files with 60 additions and 52 deletions

View File

@@ -63,17 +63,25 @@ function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
});
if (scope.selected.length > 0 ) {
var user;
for (var i=0; i < scope.selected.length; i++) {
//var admin = scope.admins[scope.selected[i]].username;
Rest.post(scope.admins[scope.selected[i]])
.success( function(data, status, headers, config) {
scope.queue.push({ result: 'success', data: data, status: status });
scope.$emit('callFinished');
})
.error( function(data, status, headers, config) {
scope.queue.push({ result: 'error', data: data, status: status, headers: headers });
scope.$emit('callFinished');
});
user = null;
for (var j=0; j < scope.admins.length; j++) {
if (scope.admins[j].id == scope.selected[i]) {
user = scope.admins[j];
}
}
if (user !== null) {
Rest.post(user)
.success( function(data, status, headers, config) {
scope.queue.push({ result: 'success', data: data, status: status });
scope.$emit('callFinished');
})
.error( function(data, status, headers, config) {
scope.queue.push({ result: 'error', data: data, status: status, headers: headers });
scope.$emit('callFinished');
});
}
}
}
else {