单击输入类型将使用AngularJS触发表单

单击输入类型将使用AngularJS触发表单,angularjs,Angularjs,当我点击按钮时,它会工作,但当我尝试添加“数量”并点击箭头时,它会立即运行该功能。我如何避免它 <form ng-click="ctrl.launch(quantity, someOtherInfo)"> <div class="quantity"> <input type="number" ng-model="quant" ng-init="quant=1" min="1" step="1"> </div>

当我点击按钮时,它会工作,但当我尝试添加“数量”并点击箭头时,它会立即运行该功能。我如何避免它

<form ng-click="ctrl.launch(quantity, someOtherInfo)">
     <div class="quantity">
          <input type="number" ng-model="quant" ng-init="quant=1" min="1" step="1">
     </div>
     <button class="hit_it_button" >LAUNCH!</button>
</form>

发射

我试图将ng click右键置于按钮中,但它根本不起作用。

您应该将
ng click
更改为
ng submit


这里有帮助

您应该将
ng单击
更改为
ng提交


这里很有帮助

我认为你的脚本应该是这样的:

<form>
 <div class="quantity">
      <input type="number" ng-model="quantity" ng-init="quant=1" min="1" step="1">
 </div>
 <button class="hit_it_button" ng-click="ctrl.launch(quantity)>LAUNCH!</button></form>


我认为你的脚本应该是这样的:

<form>
 <div class="quantity">
      <input type="number" ng-model="quantity" ng-init="quant=1" min="1" step="1">
 </div>
 <button class="hit_it_button" ng-click="ctrl.launch(quantity)>LAUNCH!</button></form>


ngClick
不提交表单。您应该将ng click更改为
ng submit

<form ng-submit="ctrl.launch(quantity, someOtherInfo)">
     <div class="quantity">
          <input type="number" ng-model="quant" ng-init="quant=1" min="1" step="1">
     </div>
     <button class="hit_it_button" >LAUNCH!</button>
</form>

发射

ngClick
不提交表单。您应该将ng click更改为
ng submit

<form ng-submit="ctrl.launch(quantity, someOtherInfo)">
     <div class="quantity">
          <input type="number" ng-model="quant" ng-init="quant=1" min="1" step="1">
     </div>
     <button class="hit_it_button" >LAUNCH!</button>
</form>

发射