2016-05-15 70 views
1

摘要:錯誤:控制器「旋轉木馬」,通過指令「滑」需要,無法找到

每當我試着在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"這個錯誤不來了。

任何即時幫助將非常可觀。謝謝。

回答

7

我能夠通過添加ng-non-bindable到具有data-slide指令的元素來解決衝突:

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