所以我试图在我的角度配置文件中访问cookie,但我一直在注入错误。
我已经查看了很多资源,但仍然无法使其工作。请帮忙
这是我的routes.js
'use strict';
/**
* Route configuration for the DashApp module.
*/
angular.module('DashApp').config(['$stateProvider', '$urlRouterProvider','$cookies',
function($stateProvider, $urlRouterProvider, $cookies) {
if($cookies.get('email') ===undefined){
console.log('user not logged in');
//this doesnt work, injecting $cookies causes error
}
// For unmatched routes
$urlRouterProvider.otherwise('/');
// Application routes
$stateProvider
.state('index', {
url: '/',
templateUrl: 'templates/dashboard.html'
})
.state('account', {
url: '/account',
templateUrl: 'templates/account.html'
});
}
]);