[英]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: 每当我尝试在
HTML DOM
使用data-slide
时,都会在js控制台中收到此错误:
Error: [$compile:ctreq] Controller 'carousel', required by directive 'slide', can't be found!
错误:[$ compile:ctreq]指令'slide'所需的控制器'carousel'找不到!
I created a application with bootstrap and angularjs. 我用bootstrap和angularjs创建了一个应用程序。 I already added this library
<script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.js"></script>
. 我已经添加了该库
<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. 创建我的应用程序时,我已将
ui.bootstrap
包含为依赖项。
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. 当我删除
data-slide="prev"
& data-slide="next"
此错误不会出现。
Any immediate help will be highly appreciable. 任何即时帮助将非常可贵。 Thanks.
谢谢。
我可以通过将ng-non-bindable
到具有data-slide
指令的元素来解决冲突:
<a data-slide="prev" href="#clients-slider" ng-non-bindable class="left carousel-control">‹</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.