UNPKG

zettapi_client

Version:

Client side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project

40 lines (32 loc) 790 B
app.directive('zlReset', function (zapiPath) { return { restrict: 'E', scope: true, replace: false, templateUrl: zapiPath + '/directives/reset/reset.html', controller: function ($scope, $auth, $location, blockUI) { $scope.reset = function (item) { if ($scope.validateReset(item)) { return; } $auth.resetPassword(item.email, item.username, function (err) { if (!err) { return $location.path("/"); } }); }; $scope.validateReset = function (item) { if (!item) { return true; } if (!item.email) { return true; } if (!item.username) { return true; } return false; }; } }; });