안녕하세요 연구원 천재 개발자, 인수가 정의되지 않은있어 - AngularJS와, 카르마 테스트
은 현재 내가 AngularJS와 학습과 몇 가지 기본적인 테스트를하고 있지만 점점 오류를 계속하고있다. 제발 도와주세요. 나는 대답을 둘러 보았지만 아무 것도 찾을 수 없었다. 귀하의 모든 도움은 대단히 감사하겠습니다.다음은 오류입니다.
`Error: [ng:areq] Argument 'controllerLogin' is not a function, got undefined
WebStrom IDE를 사용하고 있습니다.
내 컨트롤러 로그인입니다 .js
'use strict'; 다음은
var loginApp = angular.module('loginApp',[]);
(function() {
//define this for the minification of javascripts
var loginScope=['$scope'];
var loginController = function($scope){
$scope.hello = "Hello Galaxy";
};
loginController.$inject = loginScope;
angular.module('loginApp').controller('loginController',loginController);
}());
는
다음
'use strict';
describe("app module", function() {
beforeEach(module("loginApp"));
describe("controllerLogin", function() {
var scope,
controller;
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
controller = $controller;
}));
it("should assign message to hello world", function() {
controller("controllerLogin", {$scope: scope});
expect(scope.message).toBe("Hello Galaxy");
});
});
});
내 galaxytest.conf.js 내 loginSpec.js입니다
다음// list of files/patterns to load in the browser
files: [
'public/scripts/angular.js',
'public/scripts/angular-mocks.js',
'public/src/app/*.js',
'public/app.js',
'**/*.js',
'test/**/*Spec.js'
],
내 app.js
//Define all the module with no dependencies.
angular.module('loginApp',[]);
//Now Define Main Module of the Application
var galaxyFrontendApp = angular.module('galaxyFrontendApp',['ngRoute','ui.bootstrap','loginApp']);
galaxyFrontendApp.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/login', {templateUrl: 'src/app/modules/login/views/viewLogin.html', action: 'loginApp.loginController'});
$routeProvider.otherwise({redirectTo: '/login'});
}]);
이하 내 색인입니다 .js
<body>
<div ng-view></div>
<!-- Please refer all the javascript files here -->
<!-- All the JS files from scripts folder -->
<script src="scripts/angular.js"></script>
<script src="scripts/angular-route.js"></script>
<script src="scripts/ui-bootstrap.js"></script>
<script src="app.js"></script>
<!-- All the JS files from App folder -->
<!-- Module Name - login -->
<script src="src/app/modules/login/controllerLogin.js"></script>
<script src="src/app/modules/login/directiveLogin.js"></script>
</body>
안내해주세요. 시간과 노력에 감사드립니다.
나는이 (당신이 plnkr.co 샘플을 설정하는 경우 도움이 될) 작동하지 않는 이유는 모르지만 컨트롤러 파일의 라인'VAR loginApp = angular.module ('loginApp', []);'는 새로운 모듈을 생성하고 변수는 어디에도 사용되지 않으며 또한 주 파일은 이미이 이름을 가진 모듈을 정의합니다. – akonsu