Let's say you have a simple animation directive for slide-in:
directives.directive('slideIn', function () {
return {
compile:function (elm) {
$(elm).css('padding-left', '200em');
return function (scope, elm, attrs) {
$(elm).animate({ 'padding-left':'0em'}, 500);
};
}
};
});
And html:
<div slide-in>foo</div>
Works great.
Now let's say the html uses Angular interpolation:
<div slide-in>{{foo}}</div>
This works on the first change to the value of scope.foo, but not on subsequent attempts.
Question is: How to reapply the directive on each change?
Seems like putting this in a link function with a watch is the way to go...