尽管在用户输入正确的用户名和密码后应用了 $scope.$apply(),isV(boolean) 的值并没有改变。$scope.$digest() 也不起作用
app.controller('validateCtrl', function($scope,$location) {
Parse.initialize("PARSE APP ID");
Parse.serverURL = 'PARSE SERVER URL'
$scope.isV="false";
$scope.submit = function(){
var username =$scope.username;
var password = $scope.password;
Parse.User.logIn(username, password, {
// If the username and password matches
success: function(user) {
alert('Welcome!');
console.log("welcome");
$scope.$apply(function(){
$scope.isV="true";
});
},
// If there is an error
error: function(user, error) {
alert(error);
}
});
console.log($scope.isV);
};
});