Ionic popup not closing in ios

Trying to create a popup mess, but its not closing when we press cancel while running in ios,
Its working fine in android.

Any suggestions.
Thank you.

var myPopup = ${
    template: '<input type="password" ng-model="data.wifi">',
    title: 'Enter Wi-Fi Password',
    subTitle: 'Please use normal things',
    scope: $scope,
    buttons: [
      { text: 'Cancel' },
        text: '<b>Save</b>',
        type: 'button-positive',
        onTap: function(e) {
          if (!$ {
            //don't allow the user to close unless he enters wifi password
          } else {
            return $;

  myPopup.then(function(res) {
    console.log('Tapped!', res);

Got the solution.

In IOS on video complete was calling twice.