我正在慢慢推進到角度。在這一點上我有形式有幾個步驟,每個步驟由NG-形式,因爲每一步包含「繼續」按鈕,共同頭我有以下循環角度動態生成表單驗證
<section ng-from="form12.{{step.id}}" ng-repeat="step in steps" id="{{step.id}}" ng-class="{active: currentSection == $index}">
<h1 class="header">{{$index + 1}}. {{step.title}}</h1>
<div class="content">
<ng-include src="step.template"></ng-include>
</div>
<!--and button code-->
<div class="content-body" ng-show="currentSection == $index">
<button ng-show="$index != 0" class="btn prev" ng-click="prevSection()">Previous</button>
<button class="btn next" ng-click="nextSection()" ng-disabled="step{{$index+1}}.$invalid">{{isLastStep($index)}}</button>
<div style="clear: both;"> </div>
</div>
</section>
所以在這方面,我都會不重複相同按鈕代碼爲每個ng形式。
在此之前,我只用NG-包括和切片硬編碼,我想我的思念$範圍現在,爲NG-包括創建一個以及NG-重複,可能有人告訴我,我怎麼可以讓繼續按鈕取決於每個ng-form驗證結果? (我如何可以訪問最上面$範圍內的每個單獨的NG-形式的結果?)
不幸的是我沒有拼寫錯了,給出的例子能正常工作,如預期 – Raimonds