我試圖找出爲什麼我有這樣的錯誤:
Uncaught Error: [$injector:modulerr]
我有下面的代碼中的index.html
Angulajs ngRoute不工作
<!DOCTYPE html>
<html ng-app="MainApp">
<head>
<meta charset="utf-8">
<link rel='stylesheet' type='text/css' href='core/sty.css'>
<script src="core/CS/ang/angular.min.js"></script>
<script src="core/CS/ang/angular-resource.min.js"></script>
<script src="core/CS/ang/angular-route.min.js"></script>
</head>
<body>
<div id="header-cont">
<div id="header">
<ul style="list-style:none;">
<li style="display:inline;float:left;"><font style="font-size:38px;top:-5px;left:-1px;position:fixed;">title</font></li>
<li class="menu">News</li>
<li class="menu"><ul class="sub-menu">
<a href="/admin/login"><li class="SMoption">1 First login</li></a>
<a href="/admin/register"><li class="SMoption">2 Duble register</li></a>
</ul>account</li>
</ul>
</div>
</div>
<ng-view></ng-view>
<script src="core/CS/mainscript.js"></script>
<script src="core/CS/config.js"></script>
<script src="core/CS/controllers.js"></script>
<script src="core/CS/modules.js"></script>
</body>
</html>
的mainscript。 js
'use strict';
var appv = angular.module("MainApp", ['ngRoute','ngResource']);
而config.js
'use strict';
appv.config(function($routeProvider) {
$routeProvider.
when('/', {
//controller: 'HomeController',
templateUrl: 'views/home.html'
}).
when('/page/:pgId', {
//controller: 'PageController',
templateUrl: 'views/page.html'
}).
when('/article/:pgId/:artId', {
//controller: 'ArticleController',
templateUrl: 'views/article.html'
}).
when('/admin/:adCode', {
//controller: 'AdminController',
templateUrl: 'views/admin.html'
}).
otherwise({templateUrl: 'views/home.html'});
$locationProvider.html5Mode(true);
});
正如你可以看到我已經包括了NG-route.js,ngRoute模塊的事,但沒有工作...
把腳本標記爲ngroute和ngresource .js文件角的js文件上面的文件和所有的人你上面的腳本 – 2014-12-13 09:49:10
你可以檢查我的答案 http://stackoverflow.com/questions/27456033/how-to-read-url-query-parameters-with-angularjs/27456353#27456353 – 2014-12-13 10:48:18