Angular-flexSlider start at specific slide using value from the scope not working

368 views Asked by At

I'm using angular-flexslider and i specified the start slide using value from the scope. But it doesn't work. startAt take currentSlide as value not 5.

$scope.currentSlide=5;

<flex-slider slide="slide in slides track by $index" start-at="currentSlide">
            <li>
                <img ng-src="{{slide}}">
            </li>

Does any one know how to fix this?

Thanks in advance.

`

1

There are 1 answers

1
Kevin F On

It looks like angular-flexslider expects an integer, not an expression: https://github.com/thenikso/angular-flexslider

startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)

Try:

$scope.currentSlide = 5;

<flex-slider slide="slide in slides track by $index" start-at="{{ currentSlide }}">
    <li>
        <img ng-src="{{slide}}">
    </li>
</flex-slider>