Angular JS repeater + Bootstrap Carousel
Angular JS repeater + Bootstrap Carousel
我试图用AngularJS的数据填充Bootstrap Carousel组件。基本上,我在carousel-inner
类中填充项目,像这样:
<div class="carousel-inner">
<div class="item" ng-repeat="screen in app.screens">
<img ng-src="screens/{{screen}}" class="center"/>
</div>
</div>
这将工作得很好,但一开始我看不到任何图片,我认为这是因为我的项目没有active
类。
在官方文档中:
<div class="carousel-inner">
<div class="active item">…</div>
<div class="item">…</div>
<div class="item">…</div>
</div>
第一个div有"active"类,并且它是可见的,当我尝试像上面那样在没有Angular JS的情况下编写示例时,它可以工作。
如何将ng-repeat中的第一项设置为"active"类?
使用如下:
<div class="item" ng-repeat="screen in app.screens" ng-class="{active : $first}">
在中,您可以看到哪些属性是在本地作用域中公开的。
相关文章:
- 如何移除或改进:在Bootstrap Carousel上聚焦风格
- 如何触发Bootstrap Carousel's转盘指示器
- Twitter Bootstrap Carousel 在向左或向右滑动控制时不断向上移动
- Bootstrap Carousel无法使用AngularJS
- Bootstrap Carousel transition ON hover only
- Twitter Bootstrap Carousel使用Joomla及其Mootools
- 如何告诉Bootstrap Carousel转到特定索引
- Twitter Bootstrap Carousel - 如何实现连续慢速滚动
- couldn't get Bootstrap carousel to work with Ember
- UI Bootstrap Carousel(带有Bootstrap 2.3.2)在AngularJS中隐藏和显示时不工作
- 使用bootstrap-carousel.js失败
- Bootstrap Carousel幻灯片2中的第二个谷歌图表没有'不要出现
- 为什么我的Bootstrap Carousel没有从第二张幻灯片移动
- Disable Keyevents for Bootstrap Carousel
- jQuery的onclick事件不会在bootstrap carousel中触发
- Bootstrap carousel -控件不可点击,不能在ASP.net MVC 5中工作
- 在Rails 4应用程序中动态地向Bootstrap Carousel添加图像
- 如何在Firefox中传递多个选项给bootstrap carousel's可选选项对象
- Bootstrap carousel开始加载wordpress
- Ui.bootstrap.carousel没有出现