<div class="carousel-inner" role="listbox" ng-repeat='item in myData'> <div class="item active"> <img ng-src="{{item.photoUrl}}" alt="pic"> <div class="carousel-caption"> <ul> <h3>{{item.description}}</h3> <li>{{item.instruction}}</li> </ul> </div> </div>
There is a bootstrap carousel, the first element has the class " active
", and the next ones inherit it when they are clicked, this way the carousel works. With ng-repeat
I can pass either all active or not pass the class at all.
Is there any way to select 1 element ng-repeat
using filter
or in another way and set the class active
, only to it.
activ
field to theitem
and check it. - GrundymyData
received in the controller, domyData[0].active = true
; and in the markup `<div class =" item "ng-class =" {active ': item.active} ">` - Grundy