1

If we are writing documentation within an Angular App is there a way to escape:

<p>{{ date | date :'short'}}</p>

So that it does not execute and instead renders as:

{{ date | date :'short'}}

Most sample documentation I've read through will put a span element around the individual pieces like this:

<span class="pun">{{</span>

Does angular have a syntax highlighting pipe that we can pass the expression through?

In AngularJS it's done like this:

 <div ng-non-bindable>Ignored: {{1 + 2}}</div>
Ole
  • 41,793
  • 59
  • 191
  • 359

1 Answers1

2

Use the ng-non-bindable/ngNonBindable attribute to indicate Angular shouldn't compile the contents of that DOM element.

Angular 8:

In your case, the new code would look like <p ngNonBindable>{{ date | date :'short'}}</p>.

AngularJS:

In your case, the new code would look like <p ng-non-bindable>{{ date | date :'short'}}</p>.

More Info: https://docs.angularjs.org/api/ng/directive/ngNonBindable#examples

user823447
  • 147
  • 2
  • 11
  • Turns out this is for AngularJS. Do you know what the corresponding version for Angular 8 is? – Ole Oct 08 '19 at 03:42
  • 1
    It should be ngNonBindable then. Check out https://ngrefs.com/latest/templates/ngnonbindable. @Ole – user823447 Oct 09 '19 at 20:12