-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem using compile="true" and language attribute/directive #35
Comments
Think I've figured out why this is happening (maybe). If in the plunkr you change the lang to "http" and then inspect element it's a bit more obvious. What we get is: <code class="hljs http">{{<span class="hljs-attribute">editObject}}</span></code>. As you can see, the AngularJS inline expression is broken up by the highlighting markup and this seems to happen before the compile step, so it's not interpreted. What is a bit odd is that if lang="json", the inline expression is intact but still isn't compiled. Maybe this is wrong interpretation but could be possible cause... |
Another update. I found this link http://stackoverflow.com/questions/25581560/dynamic-syntax-highlighting-with-angularjs-and-highlight-js, and a slightly modified version of their directive (in the accepted answer) did the trick for me -- my use case is very simple. |
Hi @jugglingcats , thanks for the reporting! The stackoverflow link is very helpful, thanks again. |
Hi, I am having this problem. I need to recompile every time a model is changed and this is not working. (not even compiling at startup) Any plans to fix this behavior? |
Hey @JonnyBGod , I've reviewed your PR. The real issue of So I re-implement The code is now on |
It seems that adding language attribute affects the compilation feature. I'm finding that the compile behaviour is a bit unpredictable - sometimes it works, sometimes not. But here is a plunkr based on the JSON pretty print example modified to show this issue.
http://plnkr.co/edit/2toXC6bCDpYNR8JPSTgD?p=preview
Notice that the expression {{editObject}} inside the last div is not being compiled. If you remove the language attribute it is compiled correctly.
Any suggested fix/workaround? It's not obvious looking at the code why this is happening.
Thanks!
The text was updated successfully, but these errors were encountered: