私は、NPMの依存関係として私のGradleビルドに角度-クッキーを追加しました:これはインストールして、私の資産フォルダに依存関係を管理する必要がありGrailsの3.2.6のように私の理解へのGradleは、角度依存性に更新していない
clientDependencies {
npm {
'angular'('1.5.x', into: 'angular') {
include 'angular.js'
}
'angular-mocks'('1.5.x', into: 'angular') {
include 'angular-mocks.js'
}
'angular-resource'('1.5.x', into: 'angular') {
include 'angular-resource.js'
}
'angular-ui-bootstrap'('1.3.x', into: 'angular') {
include 'ui-bootstrap-tpls.js'
}
'angular-ui-router'('0.2.x', into: 'angular', from: 'release') {
include 'angular-ui-router.js'
}
'bootstrap'('3.3.x', into: 'bootstrap', from: 'dist/css') {
include 'bootstrap.css'
}
'angular-cookies'('1.5.x', into: 'angular') {
include 'angular-cookies.js'
include 'angular-cookies.min.js'
}
}
}
/vendor/angular/
?私はまた私のjsファイルに含まれている
Uncaught Error: [$injector:modulerr] Failed to instantiate module fytrnlt
due to:
Error: [$injector:modulerr] Failed to instantiate module fytrnlt.fytrnlt due to:
Error: [$injector:modulerr] Failed to instantiate module ngCookies due to:
Error: [$injector:nomod] Module 'ngCookies' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.11/ $インジェクター/ nomod P0 = ngCookies
:
しかし、更新していないよう、私は、依存関係のエラーが不足してます?。
angular
//.module("fytrnlt.fytrnlt")
.module("fytrnlt.fytrnlt", ["ngCookies"])
.factory('authInterceptor', function ($rootScope, $window) {
return {
request: function (config) {
config.headers = config.headers || {};
if ($window.sessionStorage.token) {
config.headers.Authorization = 'Bearer ' + $window.sessionStorage.token;
}
return config;
}
};
})
.config(function ($httpProvider) {
$httpProvider.interceptors.push('authInterceptor');
})
.controller("FytrnltListController", FytrnltListController);
//function FytrnltListController(Fytrnlt){
//function FytrnltListController(Fytrnlt, $http, $window) {
function FytrnltListController(Fytrnlt, $http, $window, $rootScope, $cookies) {
var vm = this;
var max = 1000, offset = 0;
/* working code without login checking
Fytrnlt.list({max: max, offset: offset}, function(data) {
vm.fytrnltList = data;
});
*/
// vm.authenticated = false;
// $rootScope.authenticated = false;
//try new logic to fetch cookie
vm.loggedcookie = $cookies.get('globals'); //see code further down
if(vm.authenticated == null){
vm.authenticated = false;
}
if($rootScope.authenticated == null)
{
$rootScope.authenticated = false;
}
vm.login = function() {
$http.post('/api/login', {
username: vm.user.username,
password: vm.user.password
}).then(function (response) {
vm.authenticated = true;
$rootScope.authenticated = true;
//store user
$rootScope.globals = {
currentUser: {
username: username
}
};
//store in cookie because I am having an arch issue
var cookieExp = new Date();
cookieExp.setDate(cookieExp.getDate()+1);
//$cookies.putObject('globals', $rootScope.globals,{expires: cookieExp});
$cookies.put('globals', $rootScope.globals,{expires: cookieExp});
$window.sessionStorage.token = response.data.access_token;
Fytrnlt.list({max: max, offset: offset}, function(data) {
vm.fytrnltList = data;
});
});
};
}
私もfytrnlt.fytrnlt.js
/= wrapped
//= require /angular/angular
//= require /angular/angular-ui-router
//= require /angular/angular-cookies
//= require /angular/angular-resource
//= require /fytrnlt/core/fytrnlt.core
//= require /fytrnlt/fybkbra/fytrnlt.fybkbra
//= require /fytrnlt/spriden/fytrnlt.spriden
//= require_self
//= require_tree services
//= require_tree controllers
//= require_tree directives
//= require_tree domain
//= require_tree templates
angular.module("fytrnlt.fytrnlt", [
"ui.router",
"ngResource",
"ngCookies", //added May23/17
"fytrnlt.core",
"fytrnlt.fybkbra",
"fytrnlt.spriden"
]).config(config);
function config($stateProvider) {
$stateProvider
.state('fytrnlt', {
url: "/api/fytrnlt",
abstract: true,
template: "<div ui-view></div>"
})
.state('fytrnlt.list', {
url: "",
templateUrl: "/fytrnlt/fytrnlt/list.html",
controller: "FytrnltListController as vm"
})
.state('fytrnlt.create', {
url: "/create",
params: {"fybkbraId":null,"spridenId":null, "fyrsignId":null},
templateUrl: "/fytrnlt/fytrnlt/create.html",
controller: "FytrnltCreateController as vm"
})
.state('fytrnlt.edit', {
url: "/edit/:id",
templateUrl: "/fytrnlt/fytrnlt/edit.html",
controller: "FytrnltEditController as vm"
})
.state('fytrnlt.show', {
url: "/show/:id",
templateUrl: "/fytrnlt/fytrnlt/show.html",
controller: "FytrnltShowController as vm"
})
.state('fytrnlt.firemyvalidations', {
url: "/firemyvalidations",
templateUrl: "/fytrnlt/fytrnlt/fvalid.html",
//controller: "FytrnltShowController as vm"
//controller: "Fytrnlt as vm"
//TestReturnmyList
});
}
フォルダ..\Vendor\angular\
にそれが含まれているしているが、あなたが使っているようですangular-cookies.js