$ cookies angular.js注入控制器

时间:2015-07-06 19:05:17

标签: javascript angularjs cookies

有人可以解释我如何向我的角度控制器注入$ cookies吗?我找到了与同一问题相关的答案,但解决方案在我的情况下不起作用!这是我的代码: https://gist.github.com/anonymous/f501a574ca67d4d0c2c3

angular-cookies.js的文件没问题,问题来自appControllers.js文件。这是控制台上的错误:

错误:[$ injector:unpr] http://errors.angularjs.org/1.3.0-beta.19/ $ injector / unpr?p0 =%24%24cookieReaderProvider%20%3C-%20%24ookieReader%20%3C-%20%24cookies

1 个答案:

答案 0 :(得分:0)

我认为这是angular-cookies版本与angularjs不兼容

确保它与angularjs相同

bower.json

  "dependencies": {
    "angular-animate": "~1.3.14",
    "angular-route": "~1.3.14",
    "angular-ui-router": "~0.2.13",
    "angular-resource": "~1.3.14",
    "bootstrap": "~3.3.5",
    "angular": "~1.3.17",
    "fontawesome": "~4.3.0",
    "lodash": "~1.3.0",
    "toastr": "~2.1.0",
    "underscore": "~1.8.2",
    "ace-builds": "~1.1.8",
    "angular-ui-ace": "~0.2.3",
    "angular-bootstrap": "~0.12.1",
    "restangular": "~1.4.0",
    "jquery": "~1.9.1",
    "ng-file-upload-shim": "~5.1.0",
    "ng-file-upload": "~5.1.0",
    "simple-line-icons": "~1.0.0",
    "angular-ui-grid": "~3.0.1",
    "angular-cookies": "~1.3.17"
  },
  "resolutions": {
    "angular": "1.3.17"
  }
}