0

I'm trying to use the native keyboard "Go" button in my login form in a PhoneGap iOS app made with AngularJS, when the user click on the "Go" button i want to launch the "connect()" function of my controller. the "ng-submit" directive is not working :

<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>

I think maybe the solution is in create a new Directive to force the action of the "onSubmit" event, i tried something like this :

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

and use it like this :

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

Not working so I'm probably getting it wrong in my directive, is anyone already have this similar issues and solve it ? Thanks

4

1 回答 1

2

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

于 2013-07-30T11:07:30.927 回答