【问题标题】:AngularJS ng-submit not working with PhoneGap iOS appAngularJS ng-submit 不适用于 PhoneGap iOS 应用程序
【发布时间】:2013-07-30 10:29:51
【问题描述】:

我正在尝试在使用 AngularJS 制作的 PhoneGap iOS 应用程序的登录表单中使用本机键盘“Go”按钮,当用户单击“Go”按钮时,我想启动“connect()”功能我的控制器。 “ng-submit”指令不起作用:

<form ng-submit="connect(mail,password);" >
        <input iscroll-bug type="mail" ng-model="mail" placeholder="E-mail">
        <input iscroll-bug id='password' type="password" ng-model="password" placeholder="Mot de passe" >
        <div ng-hide='loader' class="yellow_btn" ng-click="connect(mail,password);" ><p>Se connecter</p></div>
        <img style='width:30px;' class='center' ng-show='loader' src='img/ajax-loader.gif' /><br/>
</form>

我认为解决方案可能是创建一个新指令来强制执行“onSubmit”事件,我尝试过这样的事情:

// Other directive i Have
.directive('submitForm', function ($timeout, callbackOnSubmit) {
  return {
    link : function(scope, element, attrs) {
      element.submit(function () {
        callbackOnSubmit();
      })
    }
  }
});

并像这样使用它:

<form submitForm="connect(mail,password)" >

不工作,所以我可能在我的指令中弄错了,是否有人已经遇到过类似的问题并解决了? 谢谢

【问题讨论】:

    标签: iphone forms angularjs cordova angularjs-directive


    【解决方案1】:

    我有一个带有 display:none 样式的 &lt;input type="submit"&gt;,当我显示它时,它正在工作,所以只需使用 visibility:hidden 并且它与本机键盘“go”按钮和 ng-submit 一起工作得很好

    【讨论】:

      猜你喜欢
      • 2017-05-14
      • 1970-01-01
      • 2016-06-23
      • 2014-11-07
      • 2015-06-14
      • 1970-01-01
      • 1970-01-01
      • 2014-09-29
      • 1970-01-01
      相关资源
      最近更新 更多