title: Ionic calling one of 3 popups depending on some variable
body: <p>I have 3 popups in my Ionic app;</p>
  
  <pre><code>angular.module('starter')
    .controller('PopupCtrl', function($scope, $ionicPopup, $timeout) {
      $scope.showAlert1 = function() {
        var alertPopup = $ionicPopup.alert({
          title: 'Succes!',
        });
      };
      $scope.showAlert2 = function() {
        var alertPopup = $ionicPopup.alert({
          title: 'Fail...',
        });
      };
      $scope.showAlert3 = function() {
        var alertPopup = $ionicPopup.alert({
          title: 'Third option',
        });
      };
    });
  </code></pre>
  
  <p>I'd like to assign them to one button. When the button is clicked and </p>
  
  <p><code>var x=1</code> i'd like to call <code>showAlert1</code></p>
  
  <p><code>var x=2</code> i'd like to call <code>showAlert2</code></p>
  
  <p><code>var x=3</code> i'd like to call <code>showAlert3</code></p>
  
  <p>Is it possible?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>My index.html structure:</p>
  
  <pre><code>&lt;body ng-app="starter" ng-controller="PopupCtrl"&gt;
  
    &lt;ion-nav-bar class="bar-positive" align-title="center"&gt;
    &lt;/ion-nav-bar&gt;
  
    &lt;ion-nav-view class="slide-left-right"&gt;&lt;/ion-nav-view&gt;
  
    &lt;script id="list.html" type="text/ng-template"&gt;
      &lt;ion-view title="MyApp"&gt;
        &lt;ion-nav-buttons side="right"&gt;
          &lt;button class="button button-icon icon ion-android-locate" ng-click="showAlert()" onclick="writeText()"&gt;&lt;/button&gt;
        &lt;/ion-nav-buttons&gt;
  
        &lt;ion-content&gt;
          &lt;ul class="list"&gt;
              &lt;!--some list--&gt;
          &lt;/ul&gt;
        &lt;/ion-content&gt;
      &lt;/ion-view&gt;
  
      &lt;!--some subpages templates--&gt;
  
  &lt;/body&gt;
  </code></pre>