我尝试使用棱角分叉,但似乎无法找到此错误的来源。
错误:[$ injector:modulerr] http://errors.angularjs.org/1.2.21/ $ injector / modulerr?p0 = NoNameApp& p1 =%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1。 2.21%2F%24injector%2Fnomod%3Fp0%3DNoNameApp%0Ay%2F%3C%40http%3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fangular%2Fangular.min.js%3A6%3A443%0AZc%2FB。模块%3C%2F%3C%2FB%5BE%5D%3C%40http%3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fangular%2Fangular.min.js%3A20%3A385%0AZc%2Fb.module% 3C%2F%3C%40http%3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fangular%2Fangular.min.js%3A20%3A273%0AE%2F%3C%40http%3A%2F%2Flocalhost%3A8080% 2FLectureWeb%2Fscript%2Fbower_components%2Fangular%2Fangular.min.js%3A33%3A206%0Aq%40http%3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fangular%2Fangular.min.js%3A7%3A288%0AE% 40http%3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fangular%2Fangular.min.js%3A33%3A148%0Agc%40http%3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript% 2Fbower_components%2Fangular%2Fangular.min.js%3A36%3A250%0Afc%2FC%40http%3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fangular%2Fangular.min.js%3A18 3A58%%0Afc%40http% 3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fangular%2Fangular.min.js%3A18%3A270%0AXc%40http%3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fangular%2Fangular.min。 JS%3A17%3A369%0A%40http%3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fangular%2Fangular.min.js%3A213%3A58%0An.Callbacks%2Fj%40http%3A%2F%2Flocalhost% 3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fjquery%2Fdist%2Fjquery.min.js%3A2%3A26852%0An.Callbacks%2Fk.fireWith%40http%3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fjquery%2Fdist% 2Fjquery.min.js%3A2%3A27661%0A.ready%40http%3A%2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_components%2Fjquery%2Fdist%2Fjquery.min.js%3A2%3A29482%0AI%40http%3A% 2F%2Flocalhost%3A8080%2FLectureWeb%2Fscript%2Fbower_compone nts%2Fjquery%2Fdist%2Fjquery.min.js%3A2%3A29656%0A angular.min.js:6
angular.module("NoNameApp",['ngRoute','ngSanitize'])
.config(['$routeProvider',function($routeProvider){
$routeProvider.
when('/home',{templateUrl:'views/partials/home.html'}).
otherwise({redirectTo: '/', templateUrl: 'views/partials/home.html'});
}])
.controller('MainController',['$rootScope','$scope','$location',function($rootScope,$scope,$location){
rootScope.dataForAllPages = {};
rootScope.globalFunctions = {};
dataForAllPages.status = "";
dataForAllPages.notifications = "";
globalFunctions.changeRoute = function(path){
$location.path(path);
};
}]);
//,'mgcrea.ngStrap.modal', 'mgcrea.ngStrap.aside', 'mgcrea.ngStrap.tooltip'
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>AngularPlayground</title>
<!-- CSS -->
<link rel="stylesheet" href="<c:url value="script/bower_components/angular/angular-csp.css" />">
<link rel="stylesheet" href="<c:url value="script/bower_components/angular-motion/dist/angular-motion.min.css" />">
<link rel="stylesheet" href="<c:url value="script/bower_components/bootstrap/dist/css/bootstrap-theme.min.css" />">
<link rel="stylesheet" href="<c:url value="script/bower_components/bootstrap/dist/css/bootstrap.min.css" />">
<link rel="stylesheet" href="<c:url value="script/bower_components/ng-table/ng-table.min.css" />">
</head>
<body ng-app="NoNameApp">
<!-- <div class="navbar navbar-default" role="navigation" bs-navbar> -->
<!-- <ul class="nav navbar-nav"> -->
<!-- <li data-match-route="home"><a href="#/home">Home</a></li> -->
<!-- <li data-match-route="/page-one"><a href="#/page-one">Page One</a></li> -->
<!-- <li data-match-route="/page-two.*"><a href="#/page-two/sub-a">Page Two</a></li> -->
<!-- </ul> -->
<!-- <div ng-view></div> -->
<!-- </div> -->
<div ng-controller="MainController">
<ul class="nav nav-pills span6">
<li><a ng-click=changeRoute('home')>Home</a></li>
<li><a ng-click=changeRoute('login')>Login</a></li>
<li><a ng-click=changeRoute('accounts')>Accounts</a></li>
</ul>
<div ng-view></div>
</div>
<div>
<script type="text/javascript" src="<c:url value="script/bower_components/jquery/dist/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/angular/angular.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/bootstrap/dist/js/bootstrap.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/angular-animate/angular-animate.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/angular-route/angular-route.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/angular-sanitize/angular-sanitize.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/angular-strap/dist/angular-strap.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/angular-strap/dist/angular-strap.tpl.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/lodash/dist/lodash.compat.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/lodash/dist/lodash.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/lodash/dist/lodash.underscore.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/ng-table/ng-table.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="script/bower_components/restangular/dist/restangular.min.js"/>"></script>
</div>
</body>
</html>
答案 0 :(得分:0)
将您的脚本文件替换为以下代码:
var NoNameApp= angular.module("NoNameApp", [
// Angular modules
'ngAnimate',
'ngRoute',
'ngSanitize',
]);
NoNameApp.run(['$route', function ($route) {
}]);
NoNameApp.config(['$routeProvider',function($routeProvider){
$routeProvider.
when('/home',{templateUrl:'views/partials/home.html'}).
otherwise({redirectTo: '/', templateUrl: 'views/partials/home.html'});
}]);
NoNameApp.controller('MainController', ['$rootScope','$scope','$location',function($rootScope,$scope,$location){
$scope.dataForAllPages = {};
$scope.globalFunctions = {};
}]);
检查编辑过的代码朋友......
答案 1 :(得分:0)
首先进入您的应用程序的是什么?角度JS文件或您的应用程序/控制器?您首先需要加载角度,然后加载控制器和应用程序文件。