我想用引導標籤分割內容。這工作正常,除了html斷開時,我將ng控制器附加到父元素。有沒有辦法使用html元素來插入ng-controller而不影響在bootstrap中顯示標籤頁所需的層次結構?AngularJS - 在引導標籤中使用多個控制器
工作標籤佈局:
<div ng-app="myApp">
<div class="tab-content">
<div id="tab1" class="tab-pane fade in active">{{ tab1_content }}</div>
<div id="tab2" class="tab-pane fade in">{{ tab2_content }}</div>
<div id="tab3" class="tab-pane fade in">{{ tab3_content }}</div>
</div> <!-- all tab-content -->
</div> <!-- end myApp -->
我如何想用我的控制器(打破了通過把內容在所有選項卡中的選項卡顯示:
<div ng-app="myApp">
<div class="tab-content">
<ng-controller ng-controller="test_controller1">
<div id="tab1" class="tab-pane fade in active">{{ tab1_content }}</div>
<div id="tab2" class="tab-pane fade in">{{ tab2_content }}</div>
</ng-controller> <!-- end test_controller1 -->
<ng-controller ng-controller="test_controller2">
<div id="tab3" class="tab-pane fade in">{{ tab3_content }}</div>
</ng-controller> <!-- end test_controller2 -->
</div> <!-- all tab-content -->
</div> <!-- end myApp -->
演示:https://jsfiddle.net/L2b4yLfa/
FishBulbX我採取了這一做法,並解決了每個標籤https://github.com/rpocklin/ui-router-tabs加載不同的控制器 – Praveen
你不應該使用引導使用angular,你應該使用[AngularUI]在純AngularJS中編寫的[Bootstrap組件](https://angular-ui.github.io/bootstrap/)。 – alphapilgrim
感謝您的意見和建議......我確實看到我目前的做法是不可行的。 –