I am trying to learn the Ionic Framework.
This can be a very simple question for someone who knows this structure. But I can not do this job.
I just need to show a warning when a button is clicked.
My index.html code contains a button:
<div class="bar bar-footer">
<div class="title">
<button class="button button-light" ng-click="showAlert()">
Origin
</button>
</div>
</div>
This is my js code:
angular.module('todo', ['ionic'])
.controller('TodoCtrl', function($scope) {
{
scope: $scope
}
});
$scope.showAlert = function() {
alert("show");
};
I get this error when a button is clicked:
Uncaught ReferenceError: $scope is not defined app.js:9
(anonymous function)
Any idea what I'm doing wrong?
user2185272
source
share