2015-08-22 24 views
0

我有這樣的電流app.jsngAnimate中斷現有ui.bootstrap.carousel

angular.module('app', ['ngRoute', 'ngSanitize', 'ui.bootstrap','ui.router', 'com.2fdevs.videogular', 'com.2fdevs.videogular.plugins.controls', 'com.2fdevs.videogular.plugins.overlayplay', 
'com.2fdevs.videogular.plugins.poster', 'com.2fdevs.videogular.plugins.buffering', 'ngDraggable','angular-loading-bar', 'chart.js', 'angularSpinner']) 

,我包括在需要我的index.html

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular-resource.min.js"></script> 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular-route.min.js"></script> 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular-sanitize.min.js"></script> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.1/ui-bootstrap-tpls.min.js"></script> 

有了這個JavaScript文件,旋轉木馬是至少工作,沒有過渡動畫,但如果我點擊箭頭切換到下一個。

然後我添加了角動畫到的index.html:

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular-animate.js"></script> 

和ngAnimate到app.js作爲依賴性。

但是這打破了旋轉木馬。有了這個,旋轉木馬將不會自行前進,點擊箭頭將不會執行任何操作。我沒有在控制檯中看到任何錯誤,也沒有看到爲什麼這不起作用。我錯過了一些CSS的東西或什麼?

+1

檢查ui-bootstrap問題跟蹤器。在1.4版本中'ngAnimate'發生了重大變化,導致現有動畫出現問題。有些我知道是固定在最後一個版本'0.13.1',你使用的是幫助我的項目 – charlietfl

+0

你是對的,好像ui.bootstrap不支持angular 1.4,我使用了1.3.17,那裏的動畫工程。 似乎我必須降級或等待0.14(看起來他們支持它) – Sheldan

+0

Bootstrap UI有一個0.13.3版本,您可能想試試。 –

回答

1

這裏可能有點晚,但有一個解決方案。製作一個基本上禁用ng-animate的指令:

app.directive('disableAnimation', function ($animate) { 
    return { 
     restrict: 'A', 
     link: function ($scope, $element, $attrs) { 
      $attrs.$observe('disableAnimation', function (value) { 
       $animate.enabled(!value, $element); 
      }); 
     } 
    } 
}); 

然後將屬性「disable-animation ='true'」添加到您的輪播標籤。另一位用戶在另一個問題上提出了此解決方案。我試圖拼命找到他,並給他應有的榮譽,如果我找到它,我會進行編輯。