4

Ionic フレームワークを学習しようとしています。

このフレームワークを知っている人にとっては、非常に簡単な質問かもしれません。しかし、私はこれを機能させることができません。

私がする必要があるのは、ボタンのクリック時にアラートを表示することです。

私のindex.htmlコードにはボタンが含まれています:

<div class="bar bar-footer">
    <div class="title">
        <button class="button button-light" ng-click="showAlert()">
        Origin
        </button>
    </div>
</div>

これは私のjsコードです:

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");
};

ボタンをクリックすると、次のエラーが発生します。

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

私が間違っていることは何ですか?

4

1 に答える 1