I have the following Angular binding setup:
<div ng-repeat="app in vm.Apps">
<div ng-style="{ background: app.bgColour }">
<p app-shadow="large"></p>
</div>
</div>
As you can see, I'm binding to a list of items, binding the inner div background, and also have a custom directive 'app-shadow'.
The code for my directive is:
function addShadowDirective($document) {
return function (scope, element, attr) {
$(element).iluminate(
{ size: 64, textSize: 30, alpha: 0.5, textAlpha: 0.2, fade: 0, fadeText: 0, includeText: false, textOnly: true, direction: "bottomRight" });
};
}
The appShadow directive depends on an existing js library (jQuery Illuminate) which uses the parent background colour of the given element. It uses JQuery.css("background-color")
to determine the parent element's bg colour (line 22 of the source link above).
My problem seems to be that when parent bgcolour is evaluated, it's not what Angular has bound. I'm guessing there's a race condition between the two directives.
Any ideas for what I can do to ensure the ng-style
directive is evaluated before my custom directive?
Thanks in advance.