2017-10-07 52 views
-1

路由不工作,它顯示噴油器錯誤。我已經在底部使用了角度和角度鏈接,但仍然無法工作。 Index.html僅顯示下面描述的錯誤,顯示空白頁面。 請幫忙!角噴油器模塊錯誤

這是我app.js

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


app.config(function($routeProvider){ 
    $routeProvider 
    //the timeline display 
    .when('/', { 
     templateUrl: 'main.html', 
     controller: 'mainController' 
    }) 
    //the login display 
    .when('/login', { 
     templateUrl: 'login.html', 
     controller: 'authController' 
    }) 
    //the signup display 
    .when('/register', { 
     templateUrl: 'register.html', 
     controller: 'authController' 
    }); 
}); 

app.controller('mainController', function ($scope) { 
    $scope.posts = []; 
    $scope.newPost = { 
     created_by: '', 
     text: '', 
     created_at: '' 
    }; 

    $scope.post = function() { 
     $scope.newPost.created_at = Date.now(); 
     $scope.posts.push($scope.newPost); 
     $scope.newPost = { 
      created_by: '', 
      text: '', 
      created_at: '' 
     }; 
    }; 
}); 

app.controller('authController', function ($scope) { 
    $scope.user = { 
     username: '', 
     password: '' 
    }; 
    $scope.error_message = ''; 

    $scope.login = function() { 
     //placeholder until authentication is implemented 
     $scope.error_message = 'login request for ' + $scope.user.username; 
    }; 

    $scope.register = function() { 
     //placeholder until authentication is implemented 
     $scope.error_message = 'registeration request for ' + $scope.user.username; 
    }; 
}); 

這是index.html的

<html> 

<head> 
    <title>Chirp</title> 

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> 
    <link rel="stylesheet" href="./css/style.css"> 
</head> 

<body ng-app="chirpApp"> 
    <div id='main' class="container"> 
     <div class="col-md-offset-2 col-md-8"> 
      <div class="ng-view"> 
<!-- content--> 
      </div> 
     </div> 
    </div> 
</body> 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script> 
<script src="./js/chirpapp.js"></script> 
</html> 

這是

angular.js:38 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.6.4/$injector/modulerr?p0=chirpApp&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.6.4%2F%24injector%2Fmodulerr%3Fp0%3DngRoute%2520%26p1%3DError%253A%2520%255B%2524injector%253Anomod%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.6.4%252F%2524injector%252Fnomod%253Fp0%253DngRoute%252520%250A%2520%2520%2520%2520at%2520https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.6.4%252Fangular.min.js%253A6%253A425%250A%2520%2520%2520%2520at%2520https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.6.4%252Fangular.min.js%253A26%253A270%250A%2520%2520%2520%2520at%2520b%2520(https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.6.4%252Fangular.min.js%253A25%253A299)%250A%2520%2520%2520%2520at%2520https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.6.4%252Fangular.min.js%253A26%253A44%250A%2520%2520%2520%2520at%2520https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.6.4%252Fangular.min.js%253A42%253A117%250A%2520%2520%2520%2520at%2520q%2520(https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.6.4%252Fangular.min.js%253A7%253A495)%250A%2520%2520%2520%2520at%2520g%2520(https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.6.4%252Fangular.min.js%253A41%253A476)%250A%2520%2520%2520%2520at%2520https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.6.4%252Fangular.min.js%253A42%253A149%250A%2520%2520%2520%2520at%2520q%2520(https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.6.4%252Fangular.min.js%253A7%253A495)%250A%2520%2520%2520%2520at%2520g%2520(https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.6.4%252Fangular.min.js%253A41%253A476)%0A%20%20%20%20at%20https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A6%3A425%0A%20%20%20%20at%20https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A42%3A407%0A%20%20%20%20at%20q%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A7%3A495)%0A%20%20%20%20at%20g%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A41%3A476)%0A%20%20%20%20at%20https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A42%3A149%0A%20%20%20%20at%20q%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A7%3A495)%0A%20%20%20%20at%20g%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A41%3A476)%0A%20%20%20%20at%20eb%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A46%3A44)%0A%20%20%20%20at%20c%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A21%3A373)%0A%20%20%20%20at%20Sc%20(https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A22%3A179) 
    at angular.js:38 
    at angular.js:4920 
    at q (angular.js:403) 
    at g (angular.js:4880) 
    at eb (angular.js:4802) 
    at c (angular.js:1914) 
    at Sc (angular.js:1935) 
    at ue (angular.js:1820) 
    at angular.js:33367 
    at HTMLDocument.b (angular.js:3431) 

路由不工作的錯誤,那就說明噴油器錯誤。我已經在底部使用了角度和角度鏈接,但仍然無法工作。 Index.html僅顯示下面描述的錯誤,顯示空白頁面。 請幫助!!路由不工作,它顯示注入器錯誤。我已經在底部使用了角度和角度鏈接,但仍然無法工作。 Index.html僅顯示下面描述的錯誤,顯示空白頁面。 請幫忙!

+0

你看過在提供的鏈接錯誤輸出? – charlietfl

+0

您是否看到網絡選項卡中的任何錯誤 – Sajeetharan

回答

2

你的錯誤顯示:

"Failed to instantiate module ngRoute due to:" 

,如果你仔細看看你有ngRoute後的空間,以便刪除,你應該是好的:

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