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

@@ -11,8 +11,8 @@
'use strict';
function GroupsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
Alert, GroupList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit,
ReturnToCaller, ClearScope)
Alert, GroupList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit,
PaginateInit, ReturnToCaller, ClearScope, ProcessErrors)
{
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//scope.
@@ -149,8 +149,7 @@ function GroupsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams
LookUpInventoryInit({ scope: scope });
// After the Organization is loaded, retrieve each related set
scope.$on('dataLoaded', function() {
scope.$on('groupLoaded', function() {
Rest.setUrl(scope['inventory_url']);
Rest.get()
.success( function(data, status, headers, config) {
@@ -161,11 +160,9 @@ function GroupsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams
ProcessErrors(scope, data, status, null,
{ hdr: 'Error!', msg: 'Failed to retrieve: ' + scope.orgnization_url + '. GET status: ' + status });
});
for (var set in relatedSets) {
scope.search(relatedSets[set].iterator);
}
});
// Retrieve detail record and prepopulate the form
@@ -189,7 +186,7 @@ function GroupsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
scope['inventory_url'] = data.related.inventory;
scope.$emit('dataLoaded');
scope.$emit('groupLoaded');
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,