Search code examples
javascripthtmlangularjspre

How to display code block in AngularJS app


I'm trying to create some website about AngularJS in AngularJS ;-) I've added ng-app on body element, and now all my code snippets (which are all in <pre><code> ... </code></pre> tags) are parsed by angular (it adds ng-binding class for example). Is there a way to tell angular that given block is only code snippet and should't be parsed?


Solution

  • Yes, you can use the ngNonBindable directive

    For example:

    <div ng-non-bindable>Ignored: {{1 + 2}}</div>