Angular: 'modulerr', "Не удалось создать экземпляр модуля

0

Я пытаюсь изучить Угловое и ударить по кирпичной стене, пытаясь добавить маршруты к моему приложению.

Я продолжаю получать эту ошибку

'modulerr', "Не удалось создать модуль

Из других вопросов, связанных с stackoverflow, я собираю его не из правильной загрузки ngRoute, а в голову загружается angular-route.js, а ngRoute объявляется в моей модульной конструкции, поэтому я немного запутался

Мой индексный файл

<!DOCTYPE html>
<html lang="en">
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js"></script>
  <script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js"></script>
  <script src="https://cdn.firebase.com/libs/angularfire/1.1.2/angularfire.min.js"></script>
  <script src="js/app.js"></script>
  <script src="js/animations.js"></script>
  <script src="js/controllers.js"></script>
  <script src="js/filters.js"></script>
  <script src="js/services.js"></script>
</head>
<body ng-app="pgpChatApp">
  <div class="view-container">
    <div ng-view="" class="view-frame"></div>
  </div>
</body>
</html>

Мой файл приложения

'use strict';

var pgpChatApp = angular.module('pgpChatApp', [
  'ngRoute',
  'firebase',
  'pgpChatAnimations',
  'pgpChatControllers',
  'pgpChatFilters',
  'pgpChatServices'
]);

pgpChatApp.config(["$routeProvider", function ($routeProvider) {
  $routeProvider.when("/home", {
    // the rest is the same for ui-router and ngRoute...
    controller: "userAuth",
    templateUrl: "partials/home.html"
  }).when("/account", {
    // the rest is the same for ui-router and ngRoute...
    controller: "AccountCtrl",
    templateUrl: "partials/msg_room.html",
    resolve: {
      // controller will not be loaded until $requireAuth resolves
      // Auth refers to our $firebaseAuth wrapper in the example above
      "currentAuth": ["Auth", function (Auth) {
        // $requireAuth returns a promise so the resolve waits for it to complete
        // If the promise is rejected, it will throw a $stateChangeError (see above)
        return Auth.$requireAuth();
      }]
    }
  });
}]);

Мой файл контроллера

var pgpChatAppControllers = angular.module('pgpChatAppControllers', []);

pgpChatAppControllers.controller("userAuth", ["$scope", "$routeParams", "Auth",
  function ($scope, $routeParams, Auth) {
    $scope.createUser = function () {
      $scope.message = null;
      $scope.error = null;

      Auth.$createUser({
        email: $scope.email,
        password: $scope.password
      }).then(function (userData) {
        $scope.message = "User created with uid: " + userData.uid;
      }).catch(function (error) {
        $scope.error = error;
      });
    };

    $scope.removeUser = function () {
      $scope.message = null;
      $scope.error = null;

      Auth.$removeUser({
        email: $scope.email,
        password: $scope.password
      }).then(function () {
        $scope.message = "User removed";
      }).catch(function (error) {
        $scope.error = error;
      });
    };
  }]);

Кто-нибудь понял, что такое исправление?

Заранее спасибо

[EDIT] Полное сообщение об исключении

http://errors.angularjs.org/1.3.15/ $ инжектор /modulerr? p0 = pgpChatAnimations & p1 = Ошибка: [$ инжектор: nomod] http://errors.angularjs.org/1.3.15/ $ инжектор/номод? p0 = pgpChatAnimations при ошибке (native) на странице https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:6:417 на странице https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:21:412 at (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:21:53) в w.bootstrap(https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:21:296) по адресу https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:35:116 at r (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:7:302) в g (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:34:399) по адресу https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js: 35: 63 at r (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:7:302) "

  • 0
    Где в вашем коде есть ссылка на "modulerr"? * обратите внимание на двойные буквы.
  • 0
    Загрузка angular после angularfire приводит к дополнительной ошибке, angularfire является плагином firebase для angular. @AndrewF Я включил полное сообщение об исключении выше
Показать ещё 11 комментариев
Теги:
model-view-controller

2 ответа

0

Я думаю, что мои имена модулей по-прежнему не соответствуют определенным модулям в app.js

Этот diff показывает исправление

https://github.com/jkirkby91/angular-firebase-chat/commit/35be74592197d16435adb322f0e24963108ed97a

0

URL-адрес для углового маршрута не работает. Попробуйте использовать:

http://code.angularjs.org/1.2.0-rc.3/angular-route.js
  • 0
    нет, он прекрасно загружается в моем приложении imgur.com/xlBsDW5
  • 0
    Да, извините, я использовал другую версию угловой JS. Я удалил ссылки на анимации, фильтры и сервисы, так как вы не предоставили эти источники, и приложение работает просто отлично ... что заставляет меня думать, что ошибка в одном из этих файлов.
Показать ещё 2 комментария

Ещё вопросы

Сообщество Overcoder
Наверх
Меню