Popup prompt how to know 'OK' or 'Cancel' clicked?

popup confirm how to know ‘OK’ or ‘Cancel’ clicked?

              title: 'Password Check',
              subTitle: 'Enter your secret password',
              inputType: 'password',
              inputPlaceholder: 'Your password'
   }).then(function(res) {
              console.log('Your name is', res);

either click the cancel or ok all trigger the then callback.


The “res” is the response from closing the prompt. If res === false, the cancel was clicked. If res === 'something else', then data was entered in the field, the “Okay” button was pressed and you are returned what was typed in the field.

@Calendee Thanks for your response. If the validation allow to leave the input blank, should we just use popup function not prompt function.

Just return true on the tap if you want to allow it to be blank.

See : http://codepen.io/calendee/pen/BHgCz

buttons: [
  { text: 'Cancel', onTap: function(e) { return true; } },
    text: '<b>Save</b>',
    type: 'button-positive',
    onTap: function(e) {
      return $scope.data.wifi || true;

@Calendee Thanks for you demo, you are so nice :smiley:

1 Like