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

Cant figure out hljs-source #91

Closed jacobgranberry closed 5 years ago

jacobgranberry commented 6 years ago

Hey there - pretty new to angular and cant for the life of me figure out hljs-source. I have a modal that pops up and renders code. I need that rendered code to be highlighted. I've tried everything but I feel like it should be simple! I would appreciate any help!

<div class="modal-body">
       <div><pre><code>{{currentPost.code}}</code></pre></div>
</div>
pc035860 commented 6 years ago

Try this

<div class="modal-body">
  <div hljs hljs-source="currentPost.code"></div>
</div>
jacobgranberry commented 6 years ago

holy crap that worked! thanks for the quick response, i really appreciate it!