2014-10-28 34 views
-2

我不明白我的錯誤是什麼。當我加載根網址時,它顯示Uncaught Error: [$injector:modulerr],並且「/ ssh」不起作用。我正在使用1.3。這裏是我的代碼:

<!DOCTYPE html> 
<html ng-app="hiren"> 
<head lang="en"> 
    <meta charset="UTF-8"> 
    <base href="/" /> 

</head> 
<body> 
     <div class="col-sm-1" ng-view> 

     </div> 
    </div> 
    <script src="lib/angular/angular.min.js"></script> 
    <script src="lib/angular-route/angular-route.min.js"></script> 
    <script src="src/hiren.js"></script> 
</body> 
</html> 

hiren.js:

angular.module('hiren', ['ngRoute']). 
    config(function($routeProvider, $locationProvider){ 
     $routeProvider 
      .when('/ssh', { 
       templateUrl: 'views/ssh.html', 
       controller: 'ssh' 

      }); 
     $locationProvider.html5Mode(true); 
    }). 
    controller('ssh', function($scope){ 
     $scope.xox = "example"; 
    }); 
+0

通常有一種**很多**更多的這些錯誤消息。他們甚至可以通過點擊進入一個Angular頁面來解釋細節 – Phil 2014-10-28 03:03:48

+0

還有兩點:1)*「也是」/ ssh「不起作用」*是一個**糟糕的**問題描述。 2)你沒有任何處理'/' – Phil 2014-10-28 03:07:04

+0

的默認請求,它從服務器端提供 – pyprism 2014-10-28 03:08:58

回答

0

你必須來包裝你的角度代碼的腳本標籤,並把它的HTML標籤內

<script> 
angular.module('hiren', ['ngRoute']). 
    config(function($routeProvider, $locationProvider){ 
     $routeProvider 
      .when('/ssh', { 
       templateUrl: 'views/ssh.html', 
       controller: 'ssh' 

      }); 
     $locationProvider.html5Mode(true); 
    }). 
    controller('ssh', function($scope){ 
     $scope.xox = "example"; 
    }); 

<script> 
相關問題