我正试着从角度js的登录页面重定向。在我的路线中,我有2个安全链接和一个公共链接:
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/customers', {
controller: 'CustomersController',
templateUrl: 'customers.html',
secure: true
})
.when('/login/:redirect*?', {
controller: 'LoginController',
templateUrl: 'login.html'
})
.when('/testing', { templateUrl: 'testing.html' })
.otherwise({ redirectTo: '/login' });
}]);
当我点击客户链接并使用电子邮件“admin@mail.com”登录并且密码无关紧要时,不会显示customer.html模板的位置:
if ($scope.email != "admin@mail.com") {
$scope.errorMessage = 'Unable to login';
return;
}
if ($scope.email == "admin@mail.com" && $routeParams && $routeParams.redirect) {
path = path + $routeParams.redirect;
}
$location.path();