So I've been wracking my head with trying to get Angular to play nice with a jQuery slideshow plugin. I have a working chunk of code now, but I don't feel like it's the "angular" way to do it. If I remove the timeout from my directive then I get the angular code fed into my plugin rather than the actual source for the image. Not sure the proper way to do this, but I'm interested in learning it.
<ul class="slideshow">
<li class="image" ng-repeat="image in listing.photoArray" pikachoose>
<img src="{{_i(image, listing.posted_date, 'l')}}">
</li>
</ul>
myapp.directive('pikachoose',function(){
return {
compile: function (element, attrs){
return function (scope, iElement, iAttrs, controller) {
if(scope.$last){
console.log(iElement.find('img').attr('src')); //outputs {{_i(image, listing.posted_date, 'l')}} not the actual source
setTimeout(function(){
//plugin runs on the ul, not the li
iElement.parent().pikachoose();
//without the timeout I get {{_i(image, listing.posted_date, 'l')}} instead of the actual source
}, 0);
}
};
}
};
});