我對Angular有問題,並向控制器注入$ cookie。
$ cookies在服務中工作正常,但是使用此控制器時我遇到了問題。
var app = angular.module('app', [
"ui.router",
"ngCookies",
'ui.bootstrap']);
angular
.module("app")
.controller("ListController", ListController);
ListController.$inject = ['$scope', 'DataService', '$state', "AuthenticationService", "$cookies"];
function ListController($scope, DataService, $state, AuthenticationService, $cookies) {
....
}
的$餅乾對象未來通過爲未定義。 angular-cookies.js包含在頁面中,並且在包含的AuthenticationService中工作。
你在控制器中傳遞parms的位置? –
首先,你應該避免混合''''和'''引號符號,選擇一個並堅持到你的項目結束。(JShint建議使用''')關於ngCookie問題,你是否試圖聲明你的控制器是否先用老式的方式?我可以請你重新制作一個笨重的bug嗎? – Freezystem