gpt4 book ai didi

javascript - 错误: $injector:modulerr Module Error

转载 作者:行者123 更新时间:2023-12-03 12:42:36 25 4
gpt4 key购买 nike

我面临这个奇怪的问题。我知道这是由于依赖项注入(inject)失败而发生的。我不知 Prop 体是什么原因。据我所知,我的模块不需要任何注入(inject),这就是为什么我那里有空数组。那为什么我会遇到这个问题呢?这是代码。

<!DOCTYPE html>
<html ng-app="aMailServices">
<head>
<title>Home Page</title>
<link type="text/css" rel="stylesheet" href="Styles/bootstrap.css" />
<link type="text/css" rel="stylesheet" href="Styles/bootstrap-theme.css" />

<script type="text/javascript" src="Scripts/angular.js"></script>
<script>
var aMailServices = angular.module('aMailServices', []);

/*function testRouteProvider($routeProvider) {

$routeProvider.when('/', {
controller: 'SimpleController',
templateUrl: 'NewProfile.html'
})
.when('/search', {
controller: 'SimpleController',
templateUrl: 'SearchPage.html'
});
}

testProject.config(testRouteProvider);*/

function emailRouteConfig($routeProvider) {
$routeProvider.
when('/', {
controller: 'SimpController',
templateUrl: 'list.html'
}).
// Notice that for the detail view, we specify a parameterized URL component
// by placing a colon in front of the id
when('/view/:id', {
controller: 'SimpController',
templateUrl: 'detail.html'
}).
otherwise({
redirectTo: '/'
});
};
// Set up our route so the AMail service can find it
aMailServices.config(emailRouteConfig);

var SimpController = function ($scope) {

};

aMailServices.controller(SimpController);

</script>
<style type="text/css">
body {
padding: 15px;
}

.inCenter {
text-align: center;
text-decoration: underline;
}

.borderBotton {
font-size: 1.2em;
font-variant: small-caps;
border-bottom: 1px solid #ddd;
}

.topMargin {
margin-top: 10px;
}
</style>
</head>
<body>
<!--Controller And ng-app-->
<div class="col-xs-12 inCenter">
<h1>Test Project</h1>
</div>

<div class="col-xs-12">
<ul class="nav nav-tabs">
<li class="active">
<a href="#">Create Profile</a> <!--On CLick-->
</li>
<li>
<a href="#">Search Profile</a>
</li>
</ul>
</div>

<div class="col-xs-12 topMargin">
<div ng-view></div>
</div>
</body>
</html>

最佳答案

实际上,您的应用程序确实具有您不知道的依赖项:“ngRoute”。路由功能被分成不同的文件。包含它并使用“ngRoute”作为依赖模块。如果您使用 Bower,请在 Bower.json 中包含“Angular-route”模块。

关于javascript - 错误: $injector:modulerr Module Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23480939/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com