Hey Jeremy, Funny seeing you here! A few things here, You are not really 
building the directive properly in my opinion Here's how I would do it, and 
after I write it here, I'm going to implement it in my code and see if it 
works so hold tight:

*HTML:*

<pikachoose photos="listing.photoArray" listing="listing"> </pikachoose>


*Angular Directive:*

myapp.directive('pikachoose', function(){

    return{

restrict: 'EA',

replace: true, 

scope: {photos: '=', listing: '='},

template: '<ul class="slideshow><li ng-repeat="image in photos" 
class="image"><img src="image"></li>', 

          link: function(scope, element) {

angular.element(element).pikachoose();

} 

  }

}


I'll be testing this out shortly and will let you know if it works for me. 
I'm not sure what your object structure looks like, so this assumes that 
image is a url, if not thats easily fixed. Also i have no idea what you are 
doing with this: {{_i(image, listing.posted_date, 'l')}} or scope.$last, So 
I left those out for now.

-Chris Trude

On Tuesday, February 12, 2013 11:55:55 AM UTC-5, Jeremy Fry wrote:
>
> 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.
>
> *The html:*
> <ul class="slideshow">
> <li class="image" ng-repeat="image in listing.photoArray" pikachoose>
> <img src="{{_i(image, listing.posted_date, 'l')}}">
> </li>
> </ul>
>
> *Here's the directive:*
> 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);
>         }
>       };
>     }
>   };
> });
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to