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

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

总结:

每当我尝试在 HTML DOM 中使用 data-slide 时,我都会在我的 js 控制台中收到此错误:

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

我使用 bootstrap 和 angularjs 创建了一个应用程序。我已经添加了这个库 <script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.js"></script>.

我在创建应用程序时将 ui.bootstrap 添加为依赖项。

整个错误:

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)

模板相关部分:

<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>

当我删除 data-slide="prev"data-slide="next" 时,此错误不会出现。

我们将不胜感激任何直接的帮助。谢谢。

我能够通过将 ng-non-bindable 添加到具有 data-slide 指令的元素来解决冲突:

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