Note that there are some explanatory texts on larger screens.

plurals
  1. POTurning jQuery plugin into directive
    primarykey
    data
    text
    <p>I'm trying to turn an existing jquery plugin into a directive to use in my angular app.</p> <p>My html:</p> <pre><code>&lt;div ng-controller="BoxController"&gt; &lt;ul class="bxslider" bx-slider="{mode: 'horizontal', pager: false, controls: true, minSlides: 1, maxSlides:4, slideWidth: 350, slideMargin:10, infiniteLoop: false, hideControlOnEnd: true}"&gt; &lt;li ng-repeat="obj in items track by $index"&gt; &lt;div class="item"&gt;&lt;img ng-src="{{obj + $index}}" /&gt;&lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>So my directive is <code>bx-slider</code> or <code>bxSlider</code></p> <pre><code>app.directive('bxSlider', function() { return { restrict: 'A', link: function(scope, element, attrs) { angular.element(element).bxSlider(scope.$eval(attrs.bxSlider)); } } }); </code></pre> <p>What happens is I get a list of images in a bulleted list. The CSS is certainly getting applied however the actions of it being a carousel isn't working. It is supposed to be something like this:</p> <p><a href="http://bxslider.com/examples/carousel-dynamic-number-slides" rel="nofollow">http://bxslider.com/examples/carousel-dynamic-number-slides</a></p> <p>However I get</p> <p><a href="http://dopserv1.dop.com/bxslider/" rel="nofollow">http://dopserv1.dop.com/bxslider/</a></p> <p>with no errors in the console or anything. If I do a <code>console.log</code> on <code>attrs.bxSlider</code> I see all the params I defined in the HTML above. What am I doing wrong here? I am including jQuery 1.10.2 above the angular include.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload