angular.module("user", []).controller("passwordController", function ($scope, $http, $location, storage) { $scope.status = 0; $scope.loading = false; $scope.requestPassword = function () { var params = { user_name: $scope.user_name }; $scope.loading = true; $http.post("/password/check/request", params).then( function (result) { $scope.status = 1; $scope.loading = true; }, function (result) { $scope.loading = false; if (result.data.code === 3) { $scope.status = 3; } else { $scope.status = 2; } } ); }; });