Thanks Kevin! 

I had forgotten about the $timeout zero trick, and watching the HTML output 
is a neat idea. It's a pity Angular doesn't have a more performant way to 
notify directives that their contents have been changed by something 
happening lower in the DOM. I guess it might be possible to use Mutation 
Observers 
<https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver> to do 
this once they are more widely supported.

Thanks,
Jon

On Wednesday, October 15, 2014 5:21:20 PM UTC+1, Kevin Shay wrote:
>
> Sorry! Try this one: http://jsfiddle.net/351vh862/1/
>
> Kevin
>
> On Wed, Oct 15, 2014 at 11:23 AM, Tony pee <[email protected] 
> <javascript:>> wrote:
>
>> that jsfiddle isnt right - its unrelated to your comments
>>
>> On 15 October 2014 08:18, Kevin Shay <[email protected] <javascript:>> 
>> wrote:
>>
>>> You can use a $timeout of zero duration to specify that a function 
>>> should be run after the current digest cycle is complete. To track when the 
>>> contents of the element change, you can $watch a function that checks for 
>>> changes. (Although this can be expensive, so should be done with caution.) 
>>> Demonstrated here:
>>>
>>> http://jsfiddle.net/2t8pmkqo/
>>>
>>> Best,
>>> Kevin
>>>
>>> On Wed, Oct 15, 2014 at 10:25 AM, Jon Rimmer <[email protected] 
>>> <javascript:>> wrote:
>>>
>>>> Hi Sander,
>>>>
>>>> I don't think I'm looking to use the DOM as a source of data. I just do 
>>>> need to do a transform that applies *after* the processing of interpolated 
>>>> content.
>>>>
>>>> I don't actually care what the values of the expressions are, I just 
>>>> need to know that they've been replaced with their values in the rendered 
>>>> DOM, so I can safely apply the syntax highlighter to the content.
>>>>
>>>> Jon
>>>>
>>>>
>>>> On Wednesday, October 15, 2014 12:56:04 PM UTC+1, Sander Elias wrote:
>>>>>
>>>>> Hi Jon,
>>>>>
>>>>> Don’t try to use the DOM as a source of data, that’s still old school 
>>>>> thinking. If you need some.expression data in your directive, put it 
>>>>> in directly,
>>>>> like
>>>>>
>>>>> <div my-directive=s"some.expression">
>>>>>    {{ other.stuff }} {{ some.expression.repeated }}
>>>>> </div>
>>>>>
>>>>> you can then read it in you link function like this:
>>>>>
>>>>>    function (scope,elm,attr) {
>>>>>       var thingIneed = attr.myDirective;
>>>>>    }
>>>>>
>>>>> Regards
>>>>> Sander
>>>>> ​
>>>>>
>>>>  -- 
>>>> 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] <javascript:>.
>>>> To post to this group, send email to [email protected] 
>>>> <javascript:>.
>>>> Visit this group at http://groups.google.com/group/angular.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  -- 
>>> 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] <javascript:>.
>>> To post to this group, send email to [email protected] 
>>> <javascript:>.
>>> Visit this group at http://groups.google.com/group/angular.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Tony Polinelli
>>
>>  -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.

Reply via email to