AngularJS |被叫功能没有做任何事情......没有错误

时间:2016-08-17 05:36:12

标签: angularjs

控制台显示"功能已运行,服务已运行"当我点击它然而没有发出http put ...看起来与我在生产中的工作代码相同...我的浏览器控制台没有任何抱怨。其他功能正常。 IE登录功能。

有什么想法吗?

这是我的代码:

HTML:

<form class="form-horizontal" name="signup" ng-submit="submitSignupForm()">

控制器:

angular.module('app').controller('Signup', function ($scope, $location, AuthService, vcRecaptchaService) {

$scope.submitSignupForm = function() {

    console.log('Ran function');

    $scope.signupForm.loading = true;

    var email = $scope.signupForm.email.toLowerCase();
    var password = $scope.signupForm.password;
    var company = $scope.signupForm.company;
    var name = $scope.signupForm.name;
    var reCaptcha = vcRecaptchaService.getResponse(newWidgetId);

    AuthService.signup(email, password, company, name, reCaptcha)
    .then(function onSuccess(res){
      $location.path('/dashboard');
    })
    .finally(function eitherWay(res) {
      $scope.signupForm.loading = false;
    });
  };
}:

AuthService.js:

angular.module('app').factory('AuthService', function ($http, $auth, ResponseService, $localStorage, $q) {

return {

signup: function (email, password, name, company, reCaptcha) {
console.log('Service ran')
  return $http.put('/api/user/signupWithEmail', {
      email     : email,
      password  : password,
      company   : company,
      name      : name,
      reCaptcha : reCaptcha
    })
    .then(function onSuccess (res){
      $localStorage.userHash = res.data.user;
      $auth.setToken(res.data.token);
    })
    .catch(function onError(res) {
      ResponseService.error(res);
      return $q.reject();
    });
}
};

0 个答案:

没有答案