2016-08-05 10 views
0

私はIonicを初めて使用しているので、イオン警告を使用してユーザーのパスワードを変更したいと考えています。私はこれだ瞬間 :私は2つの異なるパスワードを入力すると今パスワードが一致しない場合のイオン警告表示エラー

let alert: Alert = Alert.create({ 
    title: 'Forgot Password', 
    subTitle: 'Enter a new password', 
    inputs: [ 
    { 
     name: 'password', 
     type: 'password', 
     placeholder: 'New Password' 
    }, 
    { 
     name: 'confirm_password', 
     type: 'password', 
     placeholder: 'Confirm Password' 
    } 
    ], 
    buttons: [ 
    { 
     text: 'Change Password', 
     handler: data => { 
     if (data.password != data.confirm_password) { 
      return false; 
     } else { 
      ...some requests sent... 
     } 
     } 
    } 
    ] 
}); 

は、警告が却下されていないが、私は警戒してメッセージを表示したいと思います。

これはIonic Alertで行うことができますか?私は何も見つけられなかった。

ありがとうございます!

答えて

1

ユーザー入力用の$ ionicPopupを使用する方がよいでしょう。それはあなたが探している角度を行うことができるようにスコープを取ります。残念ながら、パスワードが一致しない場合、プログラムで保存ボタンを無効にすることはできません。

$ionicPopup.show({ 
    template: '<input type="password" ng-model="data.password">' + 
       '<input type="password" ng-model="data.confirm_password">' + 
       '<div ng-show="data.password!=data.confirm_password>Passwords do not match</div>' 
    title: 'Forgot Password', 
    subTitle: 'Enter a new password', 
    scope: $scope, 
    buttons: [ 
     { text: 'Cancel' }, 
     { 
     text: 'Save', 
     type: 'button-positive', 
     onTap: function(e) { 
      if (data.password != data.confirm_password) { 
      return false; 
      } else { 
      ...some requests sent... 
      } 
     } 
     } 
    ] 
    }); 
関連する問題