Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scope.createUser = function (userTypes, userKey, userValue) {
- $mdDialog.show({
- templateUrl: 'views/createUser.tmpl.html',
- parent: angular.element(document.body),
- targetEvent: event,
- clickOutsideToClose: true,
- controller: function (scope, $mdDialog) {
- scope.userTypes = userTypes;
- scope.newUser = {
- userType: userTypes[0]
- };
- scope._createUser = function () {
- Auth.createUser({
- email: scope.newUser.email,
- password: scope.newUser.password,
- userType: scope.newUser.userType,
- orgId: userValue
- })
- .$promise
- .then(function (res) {
- toastr.success('User successfully created');
- // outerScope.users.push(res); // this is what i want
- // outerScope.selectedUser = res; // this is what i want
- })
- .catch(function (err) {
- toastr.error('Error creating user: ' + err.statusText);
- });
- };
- scope.closeCreateUser = function() {
- $mdDialog.cancel();
- };
- }
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement