Angularjs 在Ionic framework中单击按钮时出错

Angularjs 在Ionic framework中单击按钮时出错,angularjs,ionic-framework,Angularjs,Ionic Framework,我正在努力学习离子框架 对于了解这个框架的人来说,这可能是一个非常简单的问题。但我没办法做到这一点 我需要做的只是在点击按钮时显示警报 My index.html代码包含以下按钮: <div class="bar bar-footer"> <div class="title"> <button class="button button-light" ng-click="showAlert()"> Origin

我正在努力学习离子框架

对于了解这个框架的人来说,这可能是一个非常简单的问题。但我没办法做到这一点

我需要做的只是在点击按钮时显示警报

My index.html代码包含以下按钮:

<div class="bar bar-footer">
    <div class="title">
        <button class="button button-light" ng-click="showAlert()">
        Origin
        </button>
    </div>
</div>
我在单击按钮时遇到此错误:

Uncaught ReferenceError: $scope is not defined app.js:9
(anonymous function)

知道我做错了什么吗?

请更改代码

angular.module('todo', ['ionic'])
.controller('TodoCtrl', function($scope) {
    {
        // Use our scope for the scope of the modal to keep it simple
        scope: $scope
    }
});

$scope.showAlert = function() {
    alert("show");
};

angular.module('todo', ['ionic'])
.controller('TodoCtrl', function($scope) {
    {
        // Use our scope for the scope of the modal to keep it simple
        scope: $scope
    }
});

$scope.showAlert = function() {
    alert("show");
};
angular.module('todo', ['ionic'])
.controller('TodoCtrl', function($scope) {
    {
        // Use our scope for the scope of the modal to keep it simple
            $scope.showAlert = function() {
                  alert("show");
             };
    }
});