3
如果在編輯後按下Enter按鈕input_a
,則會調用processInputA()
。 submit()
功能被省略。AngularJS:表單中的第一個按鈕即使不是提交按鈕,也會輸入按鈕按下
input_b
這不會發生:即使它與input_a
類似,它也可以按預期工作。按預期方式調用submit()
函數。
如何防止input_a
發射後的按鈕?
<form class="uk-form" ng-submit="submit()">
<div class="uk-form-row">
<input type="text"
name="input_a"
ng-model="buffer.inputA" ng-change="reportInputATyped()"
class="uk-width-3-10 uk-form-small">
<button ng-cloak ng-show="inputADirty" class="uk-button uk-button-small" ng-click="processInputA()">Apply</button>
/
<input type="text"
name="input_b"
ng-model="buffer.inputB" ng-change="reportInputBTyped()"
class="uk-width-6-10 uk-form-small">
<button ng-cloak ng-show="inputBDirty" class="uk-button uk-button-small" ng-click="processInputB()">Apply</button>
</div>
// ...further inputs...
</form>
AngularJS:http://angular-meteor.com
您可以創建一個演示?很明顯,爲什麼進入大火會提交,但第二個應該表現相同。可能有一些你沒有顯示的代碼會與第二個輸入相互作用而阻止它。 – dfsq
當我在第一個輸入中按下它時,它__不會觸發火災:它觸發click處理程序'processInputA()'。 (但是它應該 - 火焰提交而不是)。 – ideaboxer
這只是本地代碼。不知道如何創建演示... – ideaboxer