Angularjs 参数';storeController';不是函数,未定义

Angularjs 参数';storeController';不是函数,未定义,angularjs,Angularjs,这是我的js文件 当我试图创建一个新的控制器时,我得到一个错误提示 参数“storeController”不是函数,未定义 有人能帮帮我吗 var myApp = angular.module('bindExample', []); myApp.controller('commonController', ['$scope', function($scope) { $scope.customers = [

这是我的js文件

当我试图创建一个新的控制器时,我得到一个错误提示

参数“storeController”不是函数,未定义

有人能帮帮我吗

var myApp = angular.module('bindExample', []);

myApp.controller('commonController', ['$scope', function($scope) {
                    $scope.customers = [
                                { name: 'John Smith', city: 'Pheonix'},
                                { name: 'John Doe', city: 'New York'},
                                { name: 'Jane Doe', city: 'San Francisco'}
                    ];
}]);

myApp.controller('StoreController', ['$scope', function($scope){

    $scope.gems=[
            {name: 'abc', price: '110.50', canPurchase: 'false', soldOut: 'true'},
            {name: 'xyz', price: '120.50', canPurchase: 'true', soldOut: 'false'}
    ];


});
HTML代码

<html ng-app="bindExample">
<head>

<script src="js/angular.min.js"></script>
</head>
<body>
      Store details
                    <div ng-controller="StoreController">
                          <h3 ng-repeat="store in gems">
                                {{store.name}}<br>
                                {{store.price}}
                           </h3>
                    </div>

   <script src="js/homeCtrl.js"/>


    </body>
    </html>

商店详情
{{store.name}}
{{store.price}}
您缺少包含javascript文件的功能。如果没有加载,angular就不会意识到它

<html ng-app="bindExample">
<head>

<script src="js/angular.min.js"></script>
<script src="js/yourScript.js"></script> <!-- your script here -->
</head>
<body>
      Store details
                    <div ng-controller="StoreController">
                          <h3 ng-repeat="store in gems">
                                {{store.name}}<br>
                                {{store.price}}
                           </h3>
                    </div>

   <script src="js/homeCtrl.js"/>


    </body>
    </html>

商店详情
{{store.name}}
{{store.price}}
它指向哪一行?您发布的代码看起来应该正常工作。根据显示“storeController”的错误消息,但您的脚本显示“storeController”,我猜这是一个区分大小写的问题。请检查控制器的名称是否匹配,以防万一。尝试清除浏览器缓存,以防出现缓存问题。