AngularJS没有加载模板 - 错误:[$ injector:nomod] /错误:[$ injector:modulerr]

时间:2016-03-11 18:43:55

标签: angularjs django

我是AngularJS的新手(以及此社区中的新手)。我正在关注Django和AngularJS的Thinkster教程(https://thinkster.io/django-angularjs-tutorial)。在完成"注册新用户"的部分后,尝试加载注册表和登录模板时遇到问题。和"记录用户"在教程中。

经过大量的研究,虽然我发现了类似的问题,但仍无法解决这一具体问题。控制台显示以下内容:

SyntaxError: syntax error
Error: [$injector:nomod] Module 'thinkster.config' 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.3.20/$injector/nomod?p0=thinkster.config
Error: [$injector:nomod] Module 'thinkster.routes' 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.3.20/$injector/nomod?p0=thinkster.routes
SyntaxError: syntax error
Error: [$injector:modulerr] Failed to instantiate module thinkster due to:
[$injector:nomod] Module 'thinkster' 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.3.20/$injector/nomod?p0=thinkster
minErr/<@http://127.0.0.1:8000/static/bower_components/angular/angular.js:63:5
module/<@http://127.0.0.1:8000/static/bower_components/angular/angular.js:1780:1
ensure@http://127.0.0.1:8000/static/bower_components/angular/angular.js:1702:5
module@http://127.0.0.1:8000/static/bower_components/angular/angular.js:1776:7
loadModules/<@http://127.0.0.1:8000/static/bower_components/angular/angular.js:4131:11
forEach@http://127.0.0.1:8000/static/bower_components/angular/angular.js:326:11
loadModules@http://127.0.0.1:8000/static/bower_components/angular/angular.js:4115:5
createInjector@http://127.0.0.1:8000/static/bower_components/angular/angular.js:4041:3
bootstrap/doBootstrap@http://127.0.0.1:8000/static/bower_components/angular/angular.js:1455:9
bootstrap@http://127.0.0.1:8000/static/bower_components/angular/angular.js:1476:5
angularInit@http://127.0.0.1:8000/static/bower_components/angular/angular.js:1370:37
@http://127.0.0.1:8000/static/bower_components/angular/angular.js:26446:5
jQuery.Callbacks/fire@http://127.0.0.1:8000/static/bower_components/jquery/dist/jquery.js:3099:1
jQuery.Callbacks/self.fireWith@http://127.0.0.1:8000/static/bower_components/jquery/dist/jquery.js:3211:7
.ready@http://127.0.0.1:8000/static/bower_components/jquery/dist/jquery.js:3417:38
completed@http://127.0.0.1:8000/static/bower_components/jquery/dist/jquery.js:3433:2

http://errors.angularjs.org/1.3.20/$injector/modulerr?p0=thinkster&p1=%5B%24injector%3Anomod%5D%20Module%20'thinkster'%20is%20not%20available!%20You%20either%20misspelled%20the%20module%20name%20or%20forgot%20to%20load%20it.%20If%20registering%20a%20module%20ensure%20that%20you%20specify%20the%20dependencies%20as%20the%20second%20argument.%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.3.20%2F%24injector%2Fnomod%3Fp0%3Dthinkster%0AminErr%2F%3C%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A63%3A5%0Amodule%2F%3C%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A1780%3A1%0Aensure%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A1702%3A5%0Amodule%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A1776%3A7%0AloadModules%2F%3C%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A4131%3A11%0AforEach%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A326%3A11%0AloadModules%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A4115%3A5%0AcreateInjector%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A4041%3A3%0Abootstrap%2FdoBootstrap%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A1455%3A9%0Abootstrap%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A1476%3A5%0AangularInit%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A1370%3A37%0A%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fangular%2Fangular.js%3A26446%3A5%0AjQuery.Callbacks%2Ffire%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fjquery%2Fdist%2Fjquery.js%3A3099%3A1%0AjQuery.Callbacks%2Fself.fireWith%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fjquery%2Fdist%2Fjquery.js%3A3211%3A7%0A.ready%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fjquery%2Fdist%2Fjquery.js%3A3417%3A38%0Acompleted%40http%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fbower_components%2Fjquery%2Fdist%2Fjquery.js%3A3433%3A2%0A angular.js:63

与此相关的任何事情?:

的index.html:

&#13;
&#13;
<!DOCTYPE html>
<html ng-app="thinkster">
<head>
  <title>thinkster-django-angular-boilerplate</title>

  <base href="/" />

  {% include 'stylesheets.html' %}
</head>

<body>
  {% include 'navbar.html' %}

  <div class="container-fluid">
    <div class="row">
      <div class="col-xs-12 ng-view"></div>
    </div>
  </div>

  {% include 'javascripts.html' %}
</body>
</html>
&#13;
&#13;
&#13;

thinkster.js:

(function() {
'use strict';

angular
    .module('thinkster', [
        'thinkster.config',
        'thinkster.routes',
        'thinkster.authentication'
    ]);

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

angular
    .module('thinkster')
    .run(run);

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

function run($http) {
    $http.defaults.xsrfHeaderName = 'X-CSRFToken';
    $http.defaults.xsrfCookieName = 'csrftoken';
}
})();

thinkster.routes.js

(function() {
'use strict';

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

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

function config($routeProvider) {
    $routeProvider.when('/register', {
        controller: 'RegisterController',
        controllerAs: 'vm',
        templateUrl: '/static/templates/authentication/register.html'
    }).when('/login', {
        controller: 'LoginController',
        controllerAs: 'vm',
        templateUrl: '/static/templates/authentication/login.html'
    }).otherwise('/');
}
})();

提前致谢!

0 个答案:

没有答案