Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's working example: <a href="http://plnkr.co/edit/KCwzmG?p=preview" rel="nofollow noreferrer">http://plnkr.co/edit/KCwzmG?p=preview</a></p> <p>With the part of the solution coming from <a href="https://stackoverflow.com/questions/15207788/calling-a-function-when-ng-repeat-has-finished">here</a>.</p> <p><strong>HTML</strong></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html ng-app="plunker"&gt; &lt;head&gt; &lt;meta charset="utf-8" /&gt; &lt;title&gt;AngularJS Plunker&lt;/title&gt; &lt;script&gt; document.write('&lt;base href="' + document.location + '" /&gt;'); &lt;/script&gt; &lt;link href="style.css" rel="stylesheet" /&gt; &lt;link href="http://bxslider.com/lib/jquery.bxslider.css" rel="stylesheet" /&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="http://bxslider.com/lib/jquery.bxslider.js"&gt;&lt;/script&gt; &lt;script src="http://code.angularjs.org/1.2.3/angular.js"&gt;&lt;/script&gt; &lt;script src="app.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div data-ng-controller="BoxController"&gt; &lt;ul class="bxslider" data-bx-slider="mode: 'horizontal', pager: false, controls: true, minSlides: 1, maxSlides:4, slideWidth: 350, slideMargin:10, infiniteLoop: false, hideControlOnEnd: true"&gt; &lt;li data-ng-repeat="obj in items track by $index" data-notify-when-repeat-finished&gt; &lt;div class="item"&gt; &lt;img data-ng-src="http://lorempixel.com/400/200/sports/{{$index + 1}}/" /&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>JS</strong></p> <pre><code>var app = angular.module('plunker', []); app.controller('BoxController', ['$scope', function ($scope) { $scope.items = [1, 2, 3, 4, 5]; }]); app.directive('bxSlider', [function () { return { restrict: 'A', link: function (scope, element, attrs) { scope.$on('repeatFinished', function () { console.log("ngRepeat has finished"); element.bxSlider(scope.$eval('{' + attrs.bxSlider + '}')); }); } } }]) .directive('notifyWhenRepeatFinished', ['$timeout', function ($timeout) { return { restrict: 'A', link: function (scope, element, attr) { if (scope.$last === true) { $timeout(function () { scope.$emit('repeatFinished'); }); } } } }]); </code></pre>
    singulars
    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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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