Skip to content

Commit

Permalink
#70 detect if we need to save or update the organization
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Sep 1, 2015
1 parent e7a51e8 commit 264f0bc
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@
};

admin.controller('EditOrganizationController', function($scope, $state, $stateParams, $rootScope, $q, OrganizationService) {
var updateOrAction = OrganizationService.createOrganization;

if(angular.isDefined($stateParams.organizationId)) {
updateOrAction = OrganizationService.updateOrganization;
OrganizationService.getOrganization($stateParams.organizationId).success(function(result) {
$scope.organization = result;
});
Expand All @@ -212,7 +215,7 @@
return;
}
validationPerformer($q, OrganizationService.checkOrganization, organization, form).then(function() {
OrganizationService.updateOrganization(organization).success(function() {
updateOrAction(organization).success(function() {
$rootScope.$emit('ReloadOrganizations', {});
$state.go('index');
});
Expand Down

0 comments on commit 264f0bc

Please sign in to comment.