I am creating an AngularJS + Ionic app, and am trying to show a popup message when the user clicks on a button.
This is the index.html:
<body ng-app="starter">
<ion-content ng-controller="HomeCtrl">
<button class="button button-block button-positive" ng-click="showpop()">
<i class="icon ion-ionic"></i>
</ion-content>
</body>
and this is the controller. I didn't put in real data.
angular.module('starter.controllers', [])
.controller('HomeCtrl', function($scope, $ionicPopup , $timeout) {
$scope.showpop = function() {
var alertPopup = $ionicPopup.alert({
title: 'Don\'t eat that!',
template: 'It might taste good'
});
alertPopup.then(function(res) {
console.log('Thank you for not eating my delicious ice cream cone');
});
};
});
When I click the button, the popup is not working. I don't know where the mistake is.