Twitter bootstrap 从UI引导中动态加载的选项卡激活第一个
我将UI Boostrap()与AngularJS和Jade一起使用。我无法在加载节时从动态生成的集合中选择第一个选项卡。这是我的代码:Twitter bootstrap 从UI引导中动态加载的选项卡激活第一个,twitter-bootstrap,angularjs,pug,Twitter Bootstrap,Angularjs,Pug,我将UI Boostrap()与AngularJS和Jade一起使用。我无法在加载节时从动态生成的集合中选择第一个选项卡。这是我的代码: div#attachments-section tabs pane(ng-repeat='attach in attachments', heading='{{attach.filename}}', active='attach.active') div.content object(width='1
div#attachments-section
tabs
pane(ng-repeat='attach in attachments', heading='{{attach.filename}}', active='attach.active')
div.content
object(width='100%', height='100%', data='{{"http://localhost/files/" + attach.content}}')
这意味着,当加载节(#附件节)时,将不选择任何选项卡。我尝试为JSON集合(附件)的第一个元素中的活动属性指定一个真值,但它不起作用
检查:我已更新了代码(带有对象标记),因为我需要使用PDF浏览器查看器显示每个附件
更新我遵循了@blesh的建议,我意识到它在Firefox中运行良好,但在Chrome中不起作用。我已经用Punkler写了一个样本
你知道会发生什么吗?我找到了!
在Chrome中,必须指定对象标记中嵌入内容的类型
<div ng-controller="MainCtrl">
<div><h2>Example</h2></div>
<div id="attachments-section">
<tabs>
<pane ng-repeat="attachment in attachments" heading="{{attachment.title}}" active="attachment.active">
<div style="height: {{objHeight}}; overflow-y: hidden;">
<object type='application/pdf' width='100%', height='100%', data='{{attachment.filename}}'></object>
</div>
</pane>
</tabs>
</div>
</div>
例子
现在,punkler中的代码可在任何浏览器中使用:
感谢您的帮助。您只需在加载第一个附件后立即将其设置为活动即可<代码>$scope.attachments[0]。active=true@blesh您的解决方案有效,但仅在Firefox中有效。我将寻找另一个解决方案,使其在Chrome中也能工作。。。。听起来不对。我希望你能设置一个plunker,这样我们就可以看到你在做什么。如果是关于选择第一个这样简单的事情,那么它应该可以工作:请尝试修改这个plunker以暴露你的问题。@pkozlowski.opensource我在早期版本中使用了类似的代码,它可以工作,但是如果你使用的是对象标记,它就不能工作。