角JS中继+引导旋转木马 [英] Angular JS repeater + Bootstrap Carousel

查看:155
本文介绍了角JS中继+引导旋转木马的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图填补了引导轮播组件与AngularJS的数据。
基本上我里面填充的物品旋转木马-内类是这样的:

I'm trying to fill a Bootstrap Carousel component with data from AngularJS. Basically I'm filling the items inside carousel-inner class like this:

 <div class="carousel-inner">
     <div class="item" ng-repeat="screen in app.screens">
       <img ng-src="screens/{{screen}}"  class="center"/>
     </div>
 </div>

这会工作得很好,但一开始我看不到任何画面,我想这是因为没有我的项目有有效类。

在官方文档:

<div class="carousel-inner">
    <div class="active item">…</div>
    <div class="item">…</div>
    <div class="item">…</div>
</div>

第一个div有活动类,它是可见的,当我尝试写我的例子中没有角JS像上面,它的工作原理。

The first div has "active" class, and it is visible, and when I try to write my example without Angular JS like above, it works.

我如何设置的第一个项目从NG-重复有积极级?

How can I set the first item from ng-repeat to have the "active" class?

推荐答案

使用以下内容:

<div class="item" ng-repeat="screen in app.screens" ng-class="{active : $first}">

这里 你可以看到哪些属性在局部范围内曝光

Here you can see which properties are exposed on the local scope.

这篇关于角JS中继+引导旋转木马的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆