Problem with Carousel Bootstrap

Asked

Viewed 989 times

2

I am using a bootstrap Carousel and the slides are not going by themselves.

This is the error that appears:

Error: [$Compile:ctreq] Controller 'Carousel', required by Directive 'slide', can’t be found!

Carousel

<div id="box-conteudo" class="clearfix">
  <div id="Box_cont_adj" class="clearfix">
    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="2000">

      <ol class="carousel-indicators">
        <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
      </ol>


      <div class="carousel-inner" role="listbox">
        <div class="item active">
          <img src="Home/images/banner_1.png" width="965" height="280" alt="...">
          <div class="carousel-caption">
            ...
          </div>
        </div>
        <div class="item">
          <img src="Home/images/banner_2.png" width="965" height="280" alt="...">
          <div class="carousel-caption">
            ...
          </div>
        </div>
        <div class="item">
          <img src="Home/images/banner_3.png" width="965" height="280" alt="...">
          <div class="carousel-caption">
            ...
          </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>
    </div>
  </div>
  </div>
 
  • Are you using Angularjs? If so, use ngNonBindable in the tags that load the data-slide="Prev" and Datta-slide="next" attributes and please edit your question. Also refer to this article of the SOF in English

1 answer

-1

There is a parameter for the carousel that you must set for him to give a autoplay, in case the interval:

$(function(){
    $('.carousel').carousel({
      interval: 2000
    });
});

If that’s not enough, which it must be, force the first trade:

$(function(){
    $('.carousel').carousel({
      interval: 2000
    });
    $('.carousel-control.right').trigger('click');
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.