Rajat Nigam
Rajat Nigam

Reputation: 271

Display carousel properly

I used angularJS along with bootstrap to display carousel. I fetched images using angular and now using ng-repeat I want to display them in a carousel. But i am facing a problem, all the images are lined one below the another. How can i resolve this issue??

My code to display carousel:

         <div id="carousel-example-generic" class="carousel slide"
              data-ride="carousel" align="center">
              <ol class="carousel-indicators">
                <li data-target="#carousel-example-generic" data-slide-to="0"></li>
                <li data-target="#carousel-example-generic" data-slide-to="1"></li>
              </ol>

              <div class="carousel-inner" role="listbox" ng-controller="bannerCtrl">
                <div>
                  <div class="item"  data-ng-repeat="banner in banners">
                    <img src="{{banner.bannerUrl}}" alt="{{banner.bannerAltText}}">
                    <div class="carousel-caption">{{banner.bannerAltText}}</div>
                  </div>
                </div>
              </div>

              <a class="left carousel-control" href="#carousel-example-generic"
              role="button" data-slide="prev"> <span
              class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
              <span class="sr-only">Previous</span>
            </a> <a class="right carousel-control" href="#carousel-example-generic"
            role="button" data-slide="next"> <span
            class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
          </a>
        </div>

Upvotes: 1

Views: 298

Answers (1)

Gaurav Sachan
Gaurav Sachan

Reputation: 320

You can use offset x for your carousel images positioning. or u can simply use angular-carousel https://github.com/revolunet/angular-carousel

Upvotes: 1

Related Questions