2014-08-28 103 views
3

嗨我是新的角度js,如何在角度js中添加图标标签>

我的问题是如何将图标添加到角js中的选项卡? 这是我到目前为止有:

<tabset panel-tabs="true" panel-class="{{demoTabbedPanelClass}}" heading="{{demoTabbedPanelHeading}}"> 
    <tab heading="Tab 1 some text ">sapiente doloribus deserunt et nam obcaecati recusandae possimus aperiam similique.</p> 
    </tab> 
    <tab heading="Tab 2 ded"> 
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur ipsam consectetur sint. Nobis facere illo iste quaerat sapiente doloribus deserunt et nam obcaecati recusandae possimus aperiam similique.</p> 
    </tab> 
</tabset> 

我加入<tab heading="Tab 2 ded <span class="icon-print">print</span>">

,但它显示的一切正是因为里面写的标题,而不是渲染为我ExSpect语言跨度..

请帮我。

回答

13

我假设你正在使用angular-ui bootstrap。使用tab-heading指令并将您的图标放在那里。

<tabset panel-tabs="true" panel-class="{{demoTabbedPanelClass}}" heading="{{demoTabbedPanelHeading}}"> 
    <tab heading="Tab 1 some text ">sapiente doloribus deserunt et nam obcaecati recusandae possimus aperiam similique.</p> 
    </tab> 
    <tab> 
    <tab-heading> 
     <i class="icon-print"></i> Tab 2 ded 
    </tab-heading> 
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur ipsam consectetur sint. Nobis facere illo iste quaerat sapiente doloribus deserunt et nam obcaecati recusandae possimus aperiam similique.</p> 
    </tab> 
</tabset> 
+0

谢谢,但我找到这个我想这个... – 2014-08-28 10:40:41

1

我使用这个固定我的问题:

<tabset> 
    <tab heading="Static title">Static content</tab> 
    <tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disabled="tab.disabled"> 
     {{tab.content}} 
    </tab> 
    <tab select="alertMe()"> 
     <tab-heading> 
     <i class="glyphicon glyphicon-bell"></i> Alert! 
     </tab-heading> 
     I've got an HTML heading, and a select callback. Pretty cool! 
    </tab> 
    </tabset> 

更多有关此去this link

0

出于某种原因,我得到了使用tab-heading以下错误上面的建议:

'tab-heading' is not a known element 

尽管选项卡工作正常,并且tab指令存在于我的本地库中。 documentation建议以下示例:

<tab (select)="alertMe()"> 
    <template tabHeading> 
    <i class="glyphicon glyphicon-bell"></i> Alert! 
    </template> 
    I've got an HTML heading, and a select callback. Pretty cool! 
</tab> 

这对我很有用。也许是由于不同的版本?或者缺少一些依赖或声明。随时纠正我或加强这种反应。