2016-07-15 10 views
0

類似のエラーを持つ他のいくつかの質問をチェックアウトしましたが、構文エラーがある可能性があるようです。私はダブルチェックし、私のコードをlinted、何が間違っているか分からない。私はレジスタコントローラを定義しましたが、それは何らかの理由で認識されていないようです。角 - 引数 'RegisterController'は関数ではありません。定義されていません

関連ファイルはファイルで、static/js/で、myApp.jsであり、これはstaticです。私は、コンテキストのために、ここで他の設定ファイルをいくつか追加しました:

myApp.js

(function() { 
    'use strict'; 

    angular 
    .module('myApp', [ 
     'myApp.config', 
     'myApp.routes' 
     //'myApp.accounts', 

    ]); 

    angular 
    .module('myApp.config', []); 

    angular 
    .module('myApp.routes', ['ngRoute']); 

    console.log(angular); 
    angular 
    .module('myApp') 
    .run(run); 

    run.$inject = ['$http']; 

    /** 
    * @name run 
    * @desc Update xsrf $http headers to align with Django's defaults 
    */ 
    function run($http) { 
    $http.defaults.xsrfHeaderName = 'X-CSRFToken'; 
    $http.defaults.xsrfCookieName = 'casrftoken'; 
    } 
})(); 

myApp.routes.js

(function() { 
    'use strict'; 

    angular 
     .module('myApp.routes') 
     .config(config); 

    config.$inject = ['$routeProvider']; 

    /** 
    * @name config 
    * @desc Define valid application routes 
    */ 
    function config($routeProvider) { 
     $routeProvider.when('/register', { 
     controller: 'RegisterController', 
     controllerAs: 'vm', 
     templateUrl: '/static/templates/authentication/register.html' 
     }).otherwise({ 
     redirectTo: '/' 
     }); 
    } 

})(); 

/静的/のJS /認証/コントローラ/レジスタ.controller.js

/** 
* Register controller 
* @namespace myApp.authentication.controllers 
*/ 
/** 
* Register controller 
* @namespace kiwi.authentication.controllers 
*/ 
(function() { 
    'use strict'; 

    angular 
    .module('kiwi.authentication.controllers') 
    .controller('RegisterController', RegisterController); 

    RegisterController.$inject = ['$location', '$scope', 'Authentication']; 

    /** 
    * @namespace RegisterController 
    */ 
    function RegisterController($location, $scope, Authentication) { 
    var vm = this; 

    vm.register = register; 

    /** 
    * @name register 
    * @desc Register a new user 
    * @memberOf kiwi.authentication.controllers.RegisterController 
    */ 
    function register() { 
     Authentication.register(vm.email, vm.password, vm.username); 
    } 
    } 
})(); 

/static/js/authentication/authentication.module.js

(function() { 
    'use strict'; 

    angular 
    .module('myApp.authentication', [ 
     'myApp.authentication.controllers', 
     'myApp.authentication.services' 
    ]); 

    angular 
    .module('myApp.authentication.controllers', []); 

    angular 
    .module('myApp.authentication.services', ['ngCookies']); 
})(); 

答えて

関連する問題