0

所以我有我的 ionic Popup 并且在从我的笔记本电脑键盘上触发 enter 按钮时,它会重新提交触发 ionicPopup 的表单并拒绝关闭。为什么会这样?

$ionicPopup.alert({
  title: ' Required Field!',
  template:'Invalid Email, Organization or Password.!'
})

这是以前工作的,它会弹出警报,然后单击我的笔记本电脑键盘输入键,它会关闭弹出窗口,但现在它不能那样工作,它会不断刷新并显示弹出窗口。

4

1 回答 1

0

$ionicPopup 可能首先是为移动环境编写的。查看他们的模板,您会发现没有逻辑可以将焦点移开并允许输入键

'<div class="popup-container" ng-class="cssClass">' 
   '<div class="popup">' 
      '<div class="popup-head">' 
        '<h3 class="popup-title" ng-bind-html="title"></h3>' 
        '<h5 class="popup-sub-title" ng-bind-html="subTitle" ng-if="subTitle"></h5>' 
      '</div>' 
  '<div class="popup-body">' 
  '</div>' 
  '<div class="popup-buttons" ng-show="buttons.length">' 
    '<button ng-repeat="button in buttons" ng-click="$buttonTapped(button, $event)" class="button" ng-class="button.type || \'button-default\'" ng-bind-html="button.text"></button>' 
  '</div>' 
'</div>' 
'</div>'

我的建议(以及我正在做的)是重写弹出窗口并添加一些逻辑1)窃取焦点和2)允许按钮上的输入键

https://stackoverflow.com/a/21534977

于 2016-02-25T20:11:16.923 回答