AngularJS:未知提供者:$$cookieReaderProvider < - $$cookieReader < - $cookies

前端之家收集整理的这篇文章主要介绍了AngularJS:未知提供者:$$cookieReaderProvider < - $$cookieReader < - $cookies前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的主要模块定义:
angular.module('app',['app.animators','app.places','app.orders','app.excursions','app.events','app.hotel','app.controllers','app.services','angular-img-cropper','ui.router','templates','ngResource','ngCookies','ui.bootstrap','ngImgCrop','angularjs-dropdown-multiselect','uiGmapgoogle-maps'])
  .config(['$httpProvider','$locationProvider','$stateProvider','$urlRouterProvider',($httpProvider,$locationProvider,$stateProvider,$urlRouterProvider) ->
    $httpProvider.defaults.headers.common['X-CSRF-Token'] = $('Meta[name=csrf-token]').attr('content')

    $urlRouterProvider.otherwise("/admin/home")

    $stateProvider.state('admin.services'
      url: '/services'
      controller: 'ServicesController'
      templateUrl: 'services.html'
    ).state('admin.home'
      url: '/home'
      templateUrl: 'home.html'
    ).state('signIn'
      url: '/admin/signin'
      controller: 'SignInController'
      templateUrl: 'signin.html'
      resolve:
        user: ['authService','$q',(authService,$q) ->
                $q.reject({ authorized : true }) if authService.currentUser()
        ]
    ).state('admin.signOut'
      url: '/signout'
      controller: 'SignOutController'
    ).state('404'
      url: '/404'
      templateUrl: '404.html'
    ).state('admin'
      abstract: true
      url: '/admin'
      template: '<ui-view />'
      resolve:
        user: ['authService',$q) ->
                $q.reject({ unAuthorized : true }) unless authService.currentUser()
              ]
    )

    $locationProvider.html5Mode(true)
])

index.html中也是< script src =“/ assets / angular-cookies / angular-cookies.js?body = 1”>.我在这个模块中得到错误

angular.module('app.services',[]).factory('authService',['SIGN_IN_ENDPOINT','SIGN_OUT_ENDPOINT','$http','$cookies',(SIGN_IN_ENDPOINT,SIGN_OUT_ENDPOINT,$http,$cookies) ->
    auth = {}
    auth.signIn = (credentials) ->
        return $http.post(SIGN_IN_ENDPOINT,{ user: credentials })
    auth.signOut = ->
        return $http.delete(SIGN_OUT_ENDPOINT)
    auth.currentUser = ->
        $cookies.remember_token

    auth
]).value('SIGN_IN_ENDPOINT',"#{ location.protocol }//#{ location.host }/sign_in").value('SIGN_OUT_ENDPOINT',"#{ location.protocol }//#{ location.host }/sign_out")
.factory("httpErrorInterceptorModule",["$q","$rootScope","$location",($q,$rootScope,$location) ->
  success = (response) ->
    return response;

  error = (response) ->
    if(response.status is 401)
      $location.path('/admin/signin')
      return $q.reject(response)

  return (httpPromise) ->
    return httpPromise.then(success,error)
]).config(["$httpProvider",($httpProvider) ->
  $httpProvider.responseInterceptors.push("httpErrorInterceptorModule")
])

错误是:错误:[$inject:unpr]未知的提供者:$$cookieReaderProvider< - $$cookieReader< - $cookies< - authService 我做错了什么?提前致谢. AngularJS版本是1.2.25.提前致谢.

angular-cookie.js版本必须具有与angular.js相同的版本

“//code.angularjs.org/X.Y.Z/angular-cookies.js”X.Y.Z是您正在运行的AngularJS版本.

猜你在找的Angularjs相关文章