0
我有一個角色列表(在數組中)並將列表顯示爲製表符(其中包含動態編號的角色)。如何在Angularjs中提交第一個表單(選項卡)時導航到下一個選項卡?
我想在成功完成第一個表單後自動導航到下一個選項卡(即下一個表單)。
我該怎麼做?
$scope.array = ["Actor", "Singer", "Lyricist"];
所以我的數組長度是3,我只會顯示Actor,Singer和Lyricist作爲選項卡。
<li ng-class="{active:isSelected(1)}" ng-if="roleActor==true"class="myli"><a href ng-click="getActorInfo()">Actor</a></li>
<li ng-class="{active:isSelected(2)}" ng-if="roleDirector==true"class="myli"><a href ng-click="getDirectorInfo()">Director</a></li>
<li ng-class="{active:isSelected(3)}" ng-if="roleSinger==true"class="myli"><a href ng-click="getSingerInfo()">Singer</a></li>
<li ng-class="{active:isSelected(4)}" ng-if="roleLyricist==true"class="myli"><a href ng-click="getLyricistInfo()">Lyricist</a></li>
我如何可以導航到第二個標籤,當我第一次提交表單(標籤),並獲得成功的消息。
<div class="panel-body newPanelBody" ng-if="actor && !director && !singer && !lyricist>
<h4><b>Please enter your mandatory details</b></h4>
<hr width="90%" style="border-color: black; margin-left: 10px;">
<form name="tForm" role="form" data-ng-init="resp()" ng-submit="savePostProfile()" novalidate>
/* My form here */
</form>
</div>
<div class="panel-body newPanelBody" ng-if=" director && !actor && !singer && !lyricist>
<h4><b>Please enter your mandatory details</b></h4>
<hr width="90%" style="border-color: black; margin-left: 10px;">
<form name="tForm" role="form" data-ng-init="resp()" ng-submit="savePostProfile()" novalidate>
/* My form here */
</form>
</div>
<div class="panel-body newPanelBody" ng-if=" singer && !actor && !director && !lyricist>
<h4><b>Please enter your mandatory details</b></h4>
<hr width="90%" style="border-color: black; margin-left: 10px;">
<form name="tForm" role="form" data-ng-init="resp()" ng-submit="savePostProfile()" novalidate>
/* My form here */
</form>
</div>
<div class="panel-body newPanelBody" ng-if="lyricist && !actor && !director && !singer >
<h4><b>Please enter your mandatory details</b></h4>
<hr width="90%" style="border-color: black; margin-left: 10px;">
<form name="tForm" role="form" data-ng-init="resp()" ng-submit="savePostProfile()" novalidate>
/* My form here */
</form>
</div>
你的數組只有3個角色,而你的html支持4個角色。你是否只想顯示你的'$ scope.array'中指定的選項卡? – Lihini
是的。我嘗試這樣做,但對我來說,一個標籤頁會導航,頁面不會保留爲第一個數組。 http://jsfiddle.net/kbjwymbq/11/ – kalai