2015-12-03 89 views
2

我無法找到/查明錯誤的根本原因。 在我的javascript文件中,我一直在word angular下找到一個綠色的波浪形。我不明白爲什麼。 (IM使用Visual Studio代碼)

HTML

<html ng-app="myapp"> 
     <head> 
      <title>Hello</title> 

      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> 
        <script type="text/javascript" src="C:\Users\john\Desktop\test.js"/> 

     </head> 
     <body > 
      <div> 
       <label>Name:</label> 
       <input type="text" ng-model="yourName" placeholder="Enter name here"> 

       <h1> Hello, {{yourName}}</h1> 

       <div ng-controller="HelloController"> 
        <h2>Say hello to {{helloTo.title}} </h2> 
        </div> 


     </body> 
    </html> 

的Javascript

(function(){ 
var app = angular.module('myapp', ['ngRoute']); 

app.controller("HelloController", function($scope){ 
    $scope.helloto={}; 
    $scope.helloto.title="AngularJS"; 

}); 

})(); 

ERROR

Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.8/$injector/modulerr?p0=myapp&p1=Error%3A%20%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.4.8%2F%24injector%2Fnomod%3Fp0%3Dmyapp%0A%20%20%20%20at%20Error%20(native)%0A%20%20%20%20at%20https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A6%3A416%0A%20%20%20%20at%20https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A24%3A186%0A%20%20%20%20at%20b%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A23%3A251)%0A%20%20%20%20at%20https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A23%3A494%0A%20%20%20%20at%20https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A38%3A117%0A%20%20%20%20at%20n%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A7%3A333)%0A%20%20%20%20at%20g%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A37%3A488)%0A%20%20%20%20at%20eb%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A41%3A249)%0A%20%20%20%20at%20c%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A19%3A463 
+0

包含JS爲'ngRoute' – Tushar

+0

有一個單獨的JS for ngRoute? –

回答

1

您必須參考該腳本NG-路線

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular-route.js"> 
相關問題