Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails angularJS在注册时更新模型关联_Ruby On Rails_Angularjs - Fatal编程技术网

Ruby on rails angularJS在注册时更新模型关联

Ruby on rails angularJS在注册时更新模型关联,ruby-on-rails,angularjs,Ruby On Rails,Angularjs,我正在为angular/rails应用程序使用模块ng token auth 当我注册新用户时,首先注册他们,然后登录,最后更新一些相关的活动记录 $auth.submitRegistration($scope.user) .then((resp) -> $scope.user.created = true # We auth user $auth.submitLogin({ email: $scope.user.email, passw

我正在为angular/rails应用程序使用模块ng token auth

当我注册新用户时,首先注册他们,然后登录,最后更新一些相关的活动记录

$auth.submitRegistration($scope.user)
  .then((resp) ->
    $scope.user.created = true
    # We auth user
    $auth.submitLogin({
      email: $scope.user.email,
      password: $scope.user.password
    }).then((resp) ->
      # We create the address and then redirect to dashboard
      $http.post(ENV.apiEndpoint + "/api/v1/address", $scope.address)
      .success((resp) ->
        notifications.add("account_created_success","success")
        # We then display the corresponding form
      ).error((resp) ->
        # Error management
      )
    ).catch (resp) ->
      #Error management
  ).catch (resp) ->
   #Error management
一切都很好,除了在OSX上的safari 5.1上,我在将信息发布到
/api/v1/address
时得到了401。如果我登录后,我可以没有问题。 它也适用于所有其他浏览器(至少我最近测试过的那些)

有人在使用ng token auth时出现此错误吗? 我怎样才能防止这种情况发生? 或者如果用户失败,我应该取消注册吗?我能这样做吗?
谢谢

提交登录失败时的状态码是什么?我认为当它失败时,您需要给出一个错误响应代码,并在错误情况下处理它。找出它失败的原因(查看服务器日志)。一旦你这样做了,你可能会想出比循环和发布更好的主意,直到它工作或注销用户。谢谢你,但问题是我没有收到任何错误消息。我假设是登录失败了,但我甚至不是100%确定。当然也不能复制这个错误。