Last active
August 29, 2015 14:13
-
-
Save michaeldjeffrey/0e010b70c1a4934a6d51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// when a new profile is loaded, convert the vertices to the new data format | |
$scope.$on('profileLoadedEvent', function (event) { | |
ProfileVertexConverterService.convert($scope.profile.vertices).then(function (vertices) { | |
// do stuff | |
ModalService.close(); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.service('ModalService', [ | |
'$timeout', | |
'$modal', | |
function ($timeout, $modal) { | |
var modalInstance, isOpen = false; | |
function open(header) { | |
if (!isOpen) { | |
modalInstance = $modal.open({ | |
templateUrl: 'static/views/modal-template.html', | |
backdrop: 'static', | |
keyboard: false, | |
windowClass: 'modal-absolute-center', | |
controllerAs: 'modal', | |
controller: function () { | |
var ctrl = this; | |
ctrl.header = header || 'Please Wait...'; | |
} | |
}); | |
isOpen = true; | |
return modalInstance; | |
} | |
} | |
function close() { | |
if (angular.isDefined(modalInstance)) { | |
modalInstance.close(); | |
isOpen = false; | |
modalInstance = undefined; | |
} | |
} | |
return { | |
open: open, | |
close: close | |
} | |
} | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.loadProfile = function (id, onSuccess) { | |
$q.when(ModalService.open('Loading profile, please wait...')).then(function(){ | |
$scope.$broadcast('profileLoadedEvent'); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment