My hljs directives weren't updating on the first event, so I noticed that the current code checks for newVal !== oldVal and for the first event newVal is equals to oldVal, because the first render isn't applied using $digest, instead it is called directly with _elm.html(interpolateFn(_interpolateScope));.
The problem happens when using
interpolate/compile
. Example w/ problem: http://plnkr.co/edit/HnWlthYQ2cPT39Xn9rjF?p=preview Example fixed: http://plnkr.co/edit/eWa4js8kaR04ROesvayp?p=previewMy hljs directives weren't updating on the first event, so I noticed that the current code checks for
newVal !== oldVal
and for the first eventnewVal
is equals tooldVal
, because the first render isn't applied using $digest, instead it is called directly with_elm.html(interpolateFn(_interpolateScope));
.Hope this help :)
Bonus: I also dropped unused
$log
dependency