I'm trying to re-direct my users if they pass my form validation (checking usernames and passwords against database values).
The validation works fine but in my .Success function the redirect doesn't seem to be working, it produces the error: 'ReferenceError: $window is not defined'.
Here's the code:
.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');
}
});
I've tried changing the location path but nothing seems to be working. Any ideas?
Thanks!
LazyTotoro