2016-09-22 28 views
0

如何在角引導中使用ng-repeat?角度自舉引導ng-repeat選項卡

// styling does not work 
    <uib-tabset active="activePill" vertical="true" type="pills"> 
    <span ng-repeat="tab in tabs track by $index"> 
     <uib-tab index="$index" heading="{{ tab.title }}">{{ tab.content }}</uib-tab> 
    </span> 
    </uib-tabset> 

我錯過了什麼? ng-repeat應該在哪裏保存樣式?

plunkr

回答

0

使用索引= 「{{$索引}}」,而不是指數= 「$指數」。看到這個

<uib-tabset active="activePill" vertical="true" type="pills"> 
    <span ng-repeat="tab in tabs track by $index"> 
     <uib-tab index="{{$index}}" heading="{{ tab.title }}">{{ tab.content }}</uib-tab> 
    </span> 
</uib-tabset> 
+0

'{{$ index}}'沒有工作。從[{$ index}}]開始,獲取'語法錯誤:令牌'{'表達式[{{$ index}}]]第2列中的無效鍵'錯誤 – Hussain