2014-07-08 102 views
3

我使用並排我的角度項目高音引導側數據幻燈片屬性衝突,使用data-slide屬性高音旋轉木馬:引導與angularJS

 <a class="carousel-control left" href="#masthead-carousel" data-slide="prev"><i class="fa fa-reply"></i></a> 

原因angularJS在瀏覽器控制檯錯誤

Error: [$compile:ctreq] http://errors.angularjs.org/1.2.17/$compile/ctreq?p0=carousel&p1=slide 
    at Error (native) 
    at http://localhost:9000/assets/js/angular/1.2/angular.min.js:6:450 
    at D (http://localhost:9000/assets/js/angular/1.2/angular.min.js:51:80) 
    at N (http://localhost:9000/assets/js/angular/1.2/angular.min.js:54:128) 
    at http://localhost:9000/assets/js/angular/1.2/angular.min.js:60:280 
    at http://localhost:9000/assets/js/angular/1.2/angular.min.js:71:373 
    at l.promise.then.D (http://localhost:9000/assets/js/angular/1.2/angular.min.js:99:263) 
    at http://localhost:9000/assets/js/angular/1.2/angular.min.js:100:417 
    at h.$get.h.$eval (http://localhost:9000/assets/js/angular/1.2/angular.min.js:111:121) 
    at h.$get.h.$digest (http://localhost:9000/assets/js/angular/1.2/angular.min.js:108:200) <div ng-class="{ 
    'active': leaving || (active &amp;&amp; !entering), 
    'prev': (next || active) &amp;&amp; direction=='prev', 
    'next': (next || active) &amp;&amp; direction=='next', 
    'right': direction=='prev', 
    'left': direction=='next' 
    }" class="carousel-control left item text-center ng-isolate-scope" ng-transclude="" href="#masthead-carousel" data-slide="prev"> 

我該如何解決這個高音揚聲器引導和角度之間的衝突

+0

您是否有任何自定義指令稱爲幻燈片幻燈片?通常''data-slide'沒有問題,除非angularjs在應用程序內部找到一個 – maurycy

+0

在我的角度模塊中沒有像'slide'或'dataSlide'或'DataSlide'的指令 –

回答

0

如果您無法替換整個現有的TWBS輪播(像我一樣),則至少可以替換兩個data-slide屬性 - 因爲這兩個屬性不被視爲Angular slide指令。所以,我從兩個'prev/next'控件中刪除了這些屬性,並編寫了一些額外的JS來手動處理單擊事件。 是這樣的:

$('.left.carousel-control').on('click', (e) -> 
    carousel = $(e.currentTarget).data('target') 
    $(carousel).carousel('prev') 
) 
3

嘗試在標籤中添加目標=「_自我」,angularjs會忽略與目標屬性鏈接

<a class="carousel-control left" href="#masthead-carousel" target="_self" data-slide="prev"><i class="fa fa-reply"></i></a> 
2

數據幻燈片被兩個引導和ui.bootstrap所以這裏有衝突。要忽略angular apply。爲此,請將ng-non-bindable插入適當的Dom元素中。