On Mar 12, 2013, at 11:13 AM, Pawel Kozlowski <
pkozlowski...@gmail.com> wrote:
> Hi!
>
> On Tue, Mar 12, 2013 at 6:08 PM, Matt Raible <
mra...@gmail.com> wrote:
>> Does the Angular UI Carousel have a feature to hide the navigation elements
>> when there's only 1 element?
>
> Nope, not at the moment, but this would be trivial to do by changing a
> template for the carousel:
>
https://github.com/angular-ui/bootstrap/blob/master/template/carousel/carousel.html
>
>> Or would you recommend doing this another way?
>
> I guess this is about dynamically generated slides, right? Otherwise
> there is not much of the carousel with just one element :-)
>
> For now you can either modify a template (to ng-hide navigation based
> on length of slides() call) or ... open an issue for this if you feel
> like this should go to the core.
Thanks for the fast response. Do you mean something like the following or do I need to use slides().length?
<div ng-mouseenter="pause()" ng-mouseleave="play()" class="carousel">
<ol class="carousel-indicators" ng-hide="slides.length == 0">
<li ng-repeat="slide in slides()" ng-class="{active: isActive(slide)}" ng-click="select(slide)"></li>
</ol>
<div class="carousel-inner" ng-transclude></div>
<a ng-click="prev()" class="carousel-control left" ng-hide="slides.length == 0">‹</a>
<a ng-click="next()" class="carousel-control right" ng-hide="slides.length == 0">›</a>
</div>