I am facing an issue where I need to postpone the compilation of a child directive until a promise in the parent directive's prelink function is resolved and a value (CONFIG) is updated.
Within the Parent's preLink:
somePromise.then(function(){
CONFIG = 1;
elem.append($compile(template)(scope));
}
The template includes the Child directive, so the Child's prelink function runs after the promise is fulfilled. However, when trying to access CONFIG within the Child's prelink, it still retains its old value ({}).
Can anyone shed light on why this is happening? Fiddle: http://jsfiddle.net/RmDuw/642/