ionicframework 我的控制器不是函数

ionicframework my Controller is not a function

我正在尝试使用离子框架和打字稿开发应用程序,但我在 ionic.bundle.js:

收到此错误

rrror: [ng:areq] Argument 'MainViewModel' is not a function, got undefined

这是我的 html 页面:

    <!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>TodoApp</title>
    <script src="cordova.js"></script>
    <link rel="stylesheet" href="css/index.css" />

    <link href="Content/ionic.css" rel="stylesheet" />
    <script src="scripts/ionic.bundle.js"></script>
    <script src="scripts/platformOverrides.js"></script>
    <script src="scripts/app/ViewModels/MainViewModel.js"></script>
    <script src="scripts/app/index.js"></script>


</head>
<body ng-app="app" ng-controller="MainViewModel">
    <div class="bar bar-header bar-light">
        <h1 class="title">Todo</h1>
    </div>
    <ion-content class="has-header">
        <div class="list">
            <div class="item item-input-inset">
                <label class="item-input-wrapper">
                    <input type="text" placeholder="New Todo"/>
                </label>
                <div class="button button-small">Add</div>
            </div>
        </div>
    </ion-content>
</body>
</html>

我在这里设置 angular:

angular.module("app", ["ionic"])
    .controller("MainViewModel", MainViewModel);

有人认识到这个问题吗?

您缺少控制器内部的回调函数。
这里是错误的

angular.module("app", ["ionic"])
    .controller("MainViewModel", function ($scope){
//yourcode

});