【发布时间】:2014-06-17 01:07:29
【问题描述】:
如果我的用户通过了我的表单验证(根据数据库值检查用户名和密码),我会尝试重定向他们。
验证工作正常,但在我的 .Success 函数中,重定向似乎不起作用,它产生错误:'ReferenceError: $window is not defined'。
代码如下:
.success(function(data) {
console.log(data);
if (!data.success) {
// if not successful, bind errors to error variables
$scope.errorUserName = data.errors.userName;
$scope.errorUserPassword = data.errors.userPassword;
} else {
// if successful, bind success message to message
$scope.message = data.message;
$window.location=('twitter.com');
}
});
我已尝试更改位置路径,但似乎没有任何效果。有什么想法吗?
谢谢!
懒人龙猫
【问题讨论】:
-
Twitter.com 只是一个占位符! :)
标签: javascript angularjs validation redirect window