I have the following directive:
.directive("picSwitcher", ["$timeout", function($timeout){
return {
restrict: "A",
scope: {
pics: "=",
fadeTime: "@",
timeForPic:"@"
},
template: '<img ng-repeat="pic in pics" src="{{pic.url}}" style="display: none"/>',
link: function ($scope, element){
$(element.find("img")[0]).css({display: "block"});
}
};
}])
My problem is when my link function is called - ng repeat is not yet “compiled” (which word should be used here instead of compiling?)
so i am trying to set css undefined .. how can i get the link function to work after ng-repeat completes ?!
while I solve it, replacing $(element.find("img")[0]).css({display: "block"});with$timeout(function(){
$(element.find("img")[0]).css({display: "block"});}, 200);
but he feels "hacked"
Is there something that I am missing to achieve my goal in a simpler way? in general, what is the best way to manipulate the ng-repeat dom element inside the link function of a user directive?
Thanks, Jimmy.