我有一個我想嵌套的表單,但這是不可能的,因爲HTML不能接受嵌套表單。有沒有一種方法可以在AngularJS的第一個表單上手動調用提交(觸發驗證,如需要)?如何在AngularJS中手動觸發表單提交?
下面的代碼看起來像:
<div ng-conroller="ContactController">
<form ng-submit="saveHeaderAndDetail()">
<label for="Description">Description</label>
<input type="text" ng-model="Description" required/>
<input type="text" style="visibility:hidden" />
</form>
<form ng-submit="addToDetail()">
...
</form>
<input type="button"
ng-click="what code could trigger the first form's submit?"/>
</div>
順便說一句,兩種形式都包括在一個控制器是否有幫助
納克提交結合「提交」事件到一個元素..和AFAIK,這應該被連接到一個按鈕或輸入[類型=提交]或輸入[type = button] DOM節點,不應該嗎? – abourget 2012-11-14 16:05:50