angularjscarouselui.bootstrap

Error: Controller 'carousel', required by directive 'slide', can't be found


Summary :

Whenever I try to use the data-slide in the HTML DOM, I get this error in my js console:

Error: [$compile:ctreq] Controller 'carousel', required by directive 'slide', can't be found!

I created a application with bootstrap and angularjs. I already added this library <script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.js"></script>.

I've included ui.bootstrap as a dependency when creating my app.

Entire error:

Error: [$compile:ctreq] Controller 'carousel', required by directive 'slide', can't be found!
http://errors.angularjs.org/1.4.10/$compile/ctreq?p0=carousel&p1=slide
    at angular.js:68
    at getControllers (angular.js:8432)
    at nodeLinkFn (angular.js:8570)
    at angular.js:8810
    at processQueue (angular.js:15097)
    at angular.js:15113
    at Scope.$eval (angular.js:16359)
    at Scope.$digest (angular.js:16175)
    at Scope.$apply (angular.js:16467)
    at done (angular.js:10852)

Relevant part of the template:

<div id="carousel-example-generic" class="carousel" data-ride="carousel" data-interval="false">
                        <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                            <span class="glyphicon glyphicon-triangle-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-triangle-right" aria-hidden="true"></span>
                            <span class="sr-only">Next</span>
                        </a>
</div>

When I removed data-slide="prev" & data-slide="next" this error not coming.


Solution

  • I was able to solve the conflict by adding the ng-non-bindable to the elements that have the data-slide directive :

      <a data-slide="prev" href="#clients-slider" ng-non-bindable class="left carousel-control">‹</a>