执行以下代码时,我在chrome控制台中遇到错误 -
未捕获错误:[$ injector:modulerr] http://errors.angularjs.org/1.6.4/ $注射器/ modulerr P0 =应用&安培; P1 =错误%3A%20%... ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A22%3A179) 在angular.js:38 在angular.js:4920 在q(angular.js:403) 在g(angular.js:4880) 在eb(angular.js:4802) at c(angular.js:1914) 在Sc(angular.js:1935) at ue(angular.js:1820) 在HTMLDocument。 (angular.js:33367) 在l(jquery.min.js:2)
appModule.js:
var app = angular.module("app",["psFramework"]);
index.html:
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>PS framework</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<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="extmodules\psDashboard\psDashboardModule.js"></script>
<script src="extmodules\psMenu\psMenuModule.js"></script>
<script src="extmodules\psFramework\psFrameworkModule.js"></script>
<script src="extmodules\psFramework\psFrameworkController.js"></script>
<script src="extmodules\psFramework\psFrameworkDirective.js"></script>
<script src="appModule.js"></script>
</head>
<body>
<ps-framework-directive></ps-framework-directive>
</body>
</html>
这是因为包含其他模块(psFramework)吗?在appModule.js
答案 0 :(得分:2)
在psFramework模块中,在一个数组中声明模块依赖项
改变这个:
angular.module("psFramework",["psMenu"],["psDashboard"]);
要:
angular.module("psFramework",["psMenu","psDashboard"]);