pc035860 / angular-highlightjs

AngularJS directive for syntax highlighting with highlight.js
http://pc035860.github.io/angular-highlightjs/example/
MIT License
294 stars 53 forks source link

Apply current scope when initializing directive #74

Closed daniloisr closed 8 years ago

daniloisr commented 8 years ago

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=preview

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

Hope this help :)

Bonus: I also dropped unused $log dependency

pc035860 commented 8 years ago

Thanks for the PR! 👍