我正在使用parse
withangularjs
来验证用户身份。这是login
功能。
$scope.doLogin = ->
Parse.User.logIn $scope.currentUser.username, $scope.currentUser.password,
success: (user) ->
console.log user
$scope.currentUser = user
error: (user, error) ->
console.log error
这是表单(在同一页面、导航栏下拉菜单和页面内容中使用了两次):
%form{"ng-submit" => "doLogin()"}
%input{"ng-model" => "currentUser.username", type: "text"}
%input{"ng-model" => "currentUser.password", type: "password"}
%button.btn.btn-block
%center Connexion
问题是,每当提交表单时,我都可以user
在控制台中看到该对象,但$scope.currentUser
并不总是得到更新。有时我必须连续提交 3 或 4 次表格才能更新。
我究竟做错了什么 ?谢谢你。