thenikso / angular-flexslider

AngularJS directive to use Woothemes' FlexSlider jQuery plugin.
MIT License
189 stars 100 forks source link

set start-at dynamically #59

Open rawzz opened 9 years ago

rawzz commented 9 years ago

When i set start-at value from a scope var the binding doesn't occur.

thenikso commented 9 years ago

That should occur. could you provide a code example please?

rawzz commented 9 years ago

$scope.currentSlide = 5;

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

rs-rayalab commented 9 years ago

same problem, how could you fix this?

arjundas commented 9 years ago

same problem, any solution?

jrothenberger commented 9 years ago

I'm pretty new at angular, so I don't understand why this is happening, but I've found a workaround. Do not include the {{}} around your variable and it will parse and evaluate as you expect:

$scope.currentSlide = 5;

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

This is the code in angular-flexslider.js that is breaking for me: if (attrKey === 'startAt') { options[attrKey] = $parse(attrVal)($scope); continue; }