title: Ionic PopUp : TypeError: Cannot read property 'confirm' of undefined
body: <p>I would like to code a simple "confirm ionic pop up", but I had this issue that I can't solve. I'm sure if you take a look you'll find it out, because now it's like I was totally blind against it ...</p>
  
  <p><strong>TypeError: Cannot read property 'confirm' of undefined</strong></p>
  
  <p>Here is my code :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// Here is the start of my "directive.js" file, I have one directive and 3 controllers
  
  var myApp = angular.module('app.directives', [])
  
  myApp.directive('activePageHighlight', ['$rootScope', '$state', function($rootScope, $state){
    
  // Something else
    
  }]);
  
  // Here is my controller
  
  myApp.controller('MainCtrl', ['$scope', function ($scope, $ionicPopup, $timeout) {
    
  $scope.info = function(){
      
  var confirmPopup = $ionicPopup.confirm({
      // Here I tried to add $scope, but I'm not sure if is it usefull
      scope:$scope,
      title: 'Consume Ice Cream',
      template: '&lt;button class="button button-primary" ng-click="info()"&gt;Confirm&lt;/button&gt;'
     });
  
     confirmPopup.then(function(res) {
       if(res) {
         console.log('You are sure');
       } else {
         console.log('You are not sure');
       }
     });
   };
  
  }]);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div ng-controller="MainCtrl"&gt;
    
      &lt;button ng-click="info()" class="calm button-block"&gt;Info 1&lt;/button&gt;
    
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thank you !</p>