Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Angular IS manipulating your dom, the ng-repeat directive is creating the elements when it has a list to work from. Because of that you need to call <code>.slides</code> after angular is done creating the elements because that plugin is altering the DOM itself.</p> <p>Here's a directive you can use to call <code>$.slides</code> on an element based on when an array has length > 0. It shows using extra attributes like 'start' to modify the call to slides too. Here it checks an array on your $scope called 'images' and calls <code>$timeout()</code> during the link phase to call <code>.slidesjs()</code> when angular is done creating the DOM. I didn't know what plugin you used so I found one called '<a href="http://slidesjs.com/" rel="nofollow">slidesjs</a> that looked similar. 'Here's a plunker: <a href="http://plnkr.co/edit/4qdUctYMIpd8WqEg0OiO?p=preview" rel="nofollow">http://plnkr.co/edit/4qdUctYMIpd8WqEg0OiO?p=preview</a></p> <p>Html:</p> <pre><code>&lt;div my-slides="images" start="4"&gt; &lt;img ng-repeat="image in images" ng-src="{{image.url}}" /&gt; &lt;/div&gt; </code></pre> <p>Directive:</p> <pre><code>app.directive('mySlides', function() { var directive = { restrict: 'A', link: function(scope, element, attrs, ctrl) { scope.$watch(attrs.mySlides, function(value) { setTimeout(function() { // only if we have images since .slidesjs() can't // be called more than once if (value.length &gt; 0) { $(element[0]).slidesjs({ preload: true, preloadImage: '/content/images/theme/loading.gif', play: attrs.play || 5000, pause: attrs.pause || 2500, start: attrs.start || 1, hoverPause: attrs.hoverPause || true, navigation: { active: true, effect: "slide" } }); } }, 1); }); } }; return directive; }); </code></pre> <p>One thing to note is that it still can only be called once, so if your image list gets updated it won't work. To do that you could create the content in the directive...</p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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