0x800a139e - JavaScript运行时错误:[ng:areq]参数'timesheetListCtrl'不是函数,未定义

时间:2015-10-15 10:11:31

标签: javascript angularjs

我无法使用这个简单的角度应用程序。我知道我可能正在做些傻事。如果有人可以提供帮助,我将非常感激。当我运行它时,我收到以下错误:

0x800a139e - JavaScript运行时错误:[ng:areq]参数'timesheetListCtrl'不是函数,未定义

的index.html

<!DOCTYPE html>
<html>
<head lang="en">

    <!-- Style sheets -->
    <link href="Content/bootstrap.css" rel="stylesheet" />
</head>

<body ng-app="timesheetManagement">

    <div class="container">
        <div ng-include="'app/HTML/timesheetListView.html'"></div>
    </div>
    <!-- Library Scripts -->
    <script src="scripts/angular.js"></script>
    <script src="Scripts/angular-resource.js"></script>
    <!-- Application Script -->
    <script src="app/app.js"></script>
    <!-- Services -->
    <script src="common/common.services.js"></script>
    <script src="common/timesheetResource.js"></script>
    <!-- Product Controllers -->
    <script src="app/HTML/"></script>
</body>

</html>

timesheetListView.html

<div class="panel panel-primary"
     ng-controller="timesheetListCtrl as vm">
    <div class="panel-heading"
         style="font-size:large">
        Product List
    </div>

app.js

(function () {
    "use strict";

    var timesheetManagement = angular
        .module("timesheetManagement",
                            ["common.services"]);

}());

timesheetListCtrl.js

(function () {
    "use strict";
    angular
        .module("timesheetManagement")
        .controller("timesheetListCtrl",
                     ["timesheetResource",  timesheetListCtrl]);

    function timesheetListCtrl(timesheetResource) {
        var vm = this;

        timesheetResource.query(function (data) {
            vm.timesheets = data
        });

    }
}());

1 个答案:

答案 0 :(得分:0)

因此,事实证明您必须在index.html中包含timesheetListCtrl.js