Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angularjs + foundation orbit

Hi I want to fill content for Foundation orbit slider dynamically using angular like:

<div class="moreGamesArea">
    <ul class="orbit" data-orbit>
        <li ng-repeat="games in catalogGames">
            <div>{{games[0]}}</div>
        </li>
    </ul>
</div>

But it doesn't initialize slider correctly. In dom-model I see 3 elements <li> as it should be - so angular works ok, but slider - has only one slide! whats wrong? Thanks

like image 250
Simcha Avatar asked Dec 31 '25 02:12

Simcha


1 Answers

First. You need to create a directive.

.directive('afterRenderRepeat', function() {
  return function(scope, element, attrs) {
    if (scope.$last){
        $(document).foundation();
    }
 };
})

Second. Call it in section ng-repeat.

<div class="moreGamesArea">
    <ul class="orbit" data-orbit>
        <li ng-repeat="games in catalogGames" data-after-render-repeat>
            <div>{{games[0]}}</div>
        </li>
    </ul>
</div>

The Directive has helped me to release foundation 5.

like image 185
gregman Avatar answered Jan 06 '26 11:01

gregman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!