Hi Jon
The linking phase of the directive is the place where you *could *set up
watchers. For example:
app.directive('myDirective', function() {
return {
restrict: 'A',
link : function(scope) {
scope.$watch('some.expression', function(newValue, oldValue) {
});
}
}
})
Working example <http://plnkr.co/edit/ODXNps?p=preview>
: http://plnkr.co/edit/ODXNps?p=preview
Regards
Justin
On Wednesday, October 15, 2014 12:19:42 PM UTC+2, Jon Rimmer wrote:
>
> If I have an element with a custom directive applied, containing an
> expression:
>
> <div my-directive>
> {{ some.expression }}
> </div>
>
> How can my-directive know when some.expression has been evaluated and
> replaced in the DOM? How can it be notified when the expression changes and
> the DOM is updated?
>
> I thought the post-link stage in the life-cycle was intended for this, but
> even at that point, accessing the element's HTML content reveals the
> expression has not been evaluated.
>
> It seems like this is a vital part of the life-cycle to be able to hook
> into, but I can't see any obvious way to do it?
>
> Jon
>
--
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.