Add user management
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
window.app.directive('userCreate', function() {
|
||||
return {
|
||||
templateUrl: '/user/template/userCreate.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
});
|
||||
|
||||
function controller($scope, userSvc){
|
||||
var vm = this;
|
||||
|
||||
vm.saving = false;
|
||||
vm.user = {};
|
||||
|
||||
vm.statusMessage = "Create a user";
|
||||
vm.errorMessages = [];
|
||||
|
||||
vm.create = function() {
|
||||
vm.statusMessage = null;
|
||||
vm.saving = true;
|
||||
userSvc.create(vm.user)
|
||||
.success(function() {
|
||||
//Close the modal
|
||||
$scope.$close();
|
||||
})
|
||||
.error(function(data) {
|
||||
vm.errorMessages = angular.copy(data.errorMessages, vm.errorMessages);
|
||||
})
|
||||
.finally(function() {
|
||||
vm.saving = false;
|
||||
});
|
||||
};
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user