title: Open alert on click of button-Ionic
body: <p>I am new to ionic and trying hard to open alert on click of button.Following is the code snippet i am using:</p>
  
  <pre><code>&lt;button class="button button-dark" ng-click="showAlert()"&gt;Sample Alert&lt;/button&gt;
  </code></pre>
  
  <p>in controller.js</p>
  
  <pre><code>.controller('PopupCtrl', function($scope, $timeout, $q, $ionicPopup) {
      $scope.showAlert = 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');
          });
      };
  })
  </code></pre>
  
  <p>I am have gone through:<a href="https://stackoverflow.com/questions/24299891/first-steps-with-ionic-to-get-popup-alert-on-button-tap-click">First steps with ionic to get popup alert on button tap / click</a> but,nothing helped.What am i doing wrong?</p>
  
  <p>Also,it gives me following error:</p>
  
  <pre><code>Error: $ionicPopup is not defined
  $scope.showAlert@http://localhost:8100/js/controllers.js:20:13
  $parseFunctionCall@http://localhost:8100/lib/ionic/js/ionic.bundle.js:21044:15
  @http://localhost:8100/lib/ionic/js/ionic.bundle.js:53458:9
  $RootScopeProvider/this.$get&lt;/Scope.prototype.$eval@http://localhost:8100/lib/ionic/js/ionic.bundle.js:23100:16
  $RootScopeProvider/this.$get&lt;/Scope.prototype.$apply@http://localhost:8100/lib/ionic/js/ionic.bundle.js:23199:18
  @http://localhost:8100/lib/ionic/js/ionic.bundle.js:53457:7
  createEventHandler/eventHandler@http://localhost:8100/lib/ionic/js/ionic.bundle.js:11713:9
  triggerMouseEvent@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2863:3
  tapClick@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2852:3
  tapMouseUp@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2925:5
  
  
  return logFn.apply(console, args); 
  </code></pre>
  
  <p>Am I needed something under app.js?</p>