Angular-在路径js页面使用$ cookies

时间:2017-01-27 01:30:48

标签: angularjs cookies routes

我试图在路由js页面中使用$ cookies,无论如何在路由中使用它?我在路由js页面中有$ cookies.get(' token')但是出错了。我把$ cookies放在功能里面。我有什么遗漏,或者$ cookies不能在路线js中使用吗?

代码:

 /* VIEW LOADS HERE */
 MainCtrl.config([ '$stateProvider','$urlRouterProvider','$locationProvider', function ($stateProvider, $urlRouterProvider, $locationProvider, $cookies){

  // Redirect any unmatched URL
  $urlRouterProvider.otherwise('/');


  // $cookies.get('token');
  if(1==1){
    // Checkout : Sign In
    $stateProvider
    .state('checkout-signin', { 
      url: '/checkout/signin',
      templateUrl: 'app/views/checkout.signin.html',
      controller: 'CartFormController',
      resolve: {
        deps: ['$ocLazyLoad', function($ocLazyLoad) {
          return $ocLazyLoad.load({
            name: 'MainCtrl',  
            files: [
              'app/controllers/cart-form.controller.js'
            ]                    
          });
        }]
      }
    })
  }
}]);

谢谢!

0 个答案:

没有答案