Tag: angularjs authentication

AngularJS-每个路由和控制器中的login和authentication

我有一个使用yeoman,grunt和bower创build的AngularJS应用程序。 我有一个login页面,有一个控制器来检查身份validation。 如果凭证是正确的我重新路由到主页。 app.js 'use strict'; //Define Routing for app angular.module('myApp', []).config(['$routeProvider', '$locationProvider', function($routeProvider,$locationProvider) { $routeProvider .when('/login', { templateUrl: 'login.html', controller: 'LoginController' }) .when('/register', { templateUrl: 'register.html', controller: 'RegisterController' }) .when('/forgotPassword', { templateUrl: 'forgotpassword.html', controller: 'forgotController' }) .when('/home', { templateUrl: 'views/home.html', controller: 'homeController' }) .otherwise({ redirectTo: '/login' }); // $locationProvider.html5Mode(true); //Remove the '#' from URL. […]