2016-07-01 15 views
0

Ich bin neu in Winkel- und ich habe versucht, instanziiert ein Winkelmodul mit Feuerbasis zu laden, aber es hält mich geben:Angular Modul schlägt mit Feuerbasis

Nicht bestandene Modul myApp aufgrund instanziiert:

Error: [$injector:nomod] Module 'myApp' 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. 

Hier ist meine app.js:

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

app.controller('myController', function($scope){ 

     $scope.names = "Coder01"; 


}); 

Html:

<!DOCTYPE html> 
    <html ng-app='myApp'> 
    <head> 
     <meta charset="utf-8"> 
     <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0-beta.2/angular.js"></script> 
     <script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"></script> 


     <script> 

      var config = { 
      apiKey: "AIzaSyBTY8XluWdgHFadZLwhlCiD5aupBBTkezU", 
      authDomain: "chatroom-60d2f.firebaseapp.com", 
      databaseURL: "https://chatroom-60d2f.firebaseio.com", 
      storageBucket: "chatroom-60d2f.appspot.com", 
      }; 
      firebase.initializeApp(config); 
     </script> 
     <script src="js/app.js"></script> 

     <title>Welcome to ChatRoom</title> 

     </head> 
     <body ng-controller="myController"> 

     <p>Input something in the input box:</p> 
     <p>Name : <input type="text" ng-model="names" placeholder="Enter name here"></p> 
     <h1>Hello {{names}}</h1> 

     </body> 
    </html> 

Hier sind alle meine Fehler:

VM3476:5 Uncaught TypeError: Cannot read property 'removeAttribute' of null(anonymous function) @ VM3310:5(anonymous function) @ VM3310:20 

app.js:1 Uncaught SyntaxError: Unexpected token < 

angular.js:68 Uncaught Error: [$injector:modulerr] 

Failed to instantiate module myApp due to: 
Error: [$injector:nomod] Module 'myApp' 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. 


VM3400:5 Uncaught TypeError: Cannot read property 'removeAttribute' of null 
+0

Nicht ganz sicher, was der Fehler sein könnte, dass Sie 'firebase' vor' js/app.js' initialisiert wird. Versuchen Sie, den 'fire base'-Skriptblock zu setzen, nachdem Sie js/app.js eingeschlossen haben. Besser noch, Sie könnten versuchen, diesen Code in den Controller selbst zu setzen – Vasseurth

Antwort

1

Fehler: Fehler Modul myApp instanziiert ...... bedeutet, dass Ihr Winkelmodul (myApp) gefunden/nicht geladen wird.

Befestigen Sie den Pfad für app.js

<script src="js/app.js"></script> 

Ich lief der Code-Datei Plunker ist, und es ist völlig in Ordnung.

https://plnkr.co/edit/dYDOi667aPb5LBpIncJ0

Verwandte Themen