我有2個文件:模塊 'sportsStore' 不可用
App.html
<!DOCTYPE html>
<html ng-app="SportsStore">
<head>
<title>SportsStore</title>
<script src="scripts/angular.js"></script>
<link href="css/bootstrap.css" rel="stylesheet" />
<link href="css/bootstrap-theme.css" rel="stylesheet" />
<script src="controllers/sportsStore.js"></script>
<script>
angular.module("sportsStore", []);
</script>
</head>
<body ng-controller="sportsStoreCtrl">
<div class="navbar navbar-inverse">
<a class="navbar-brand" href="#">SPORTS STORE</a>
</div>
<div class="panel panel-default row">
<div class="col-xs-3">
Categories go here
</div>
<div class="col-xs-8">
<div class="well" ng-repeat="item in data.products">
<h3>
<strong>{{item.name}}</strong>
<span class="pull-right label label-primary">
{{item.price | currency}}
</span>
</h3>
<span class="lead">{{item.description}}</span>
</div>
</div>
</div>
</body>
</html>
SportsStore.js
angular.module("sportsStore")
.controller("sportsStoreCtrl", function ($scope) {
$scope.data = {
products: [
{
name: "Product #1", description: "A product",
category: "Category #1", price: 100
},
{
name: "Product #2", description: "A product",
category: "Category #1", price: 110
},
{
name: "Product #3", description: "A product",
category: "Category #2", price: 210
},
{
name: "Product #4", description: "A product",
category: "Category #3", price: 202
}]
};
});
爲什麼會收到以下錯誤在Chrome?
Uncaught Error: [$injector:nomod] Module 'sportsStore' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.