【发布时间】: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