Angular directive input with backticks for asciimath for mathjax

I used https://medium.com/kongsberg-digital/how-to-render-mathml-in-browser-using-angular-and-mathjax-3-along-with-lazy-loading-83f791911cfd to add mathjax to my angular app and got it to work with asciimath format. My problem is when I try to put a literal in the input field.

working -

app.ts

  expr='`a=b`'

app.html

<p [appMath]="expr"></p>

not working -

app.ts

app.html

<p [appMath]="`a=b`"></p>

I would prefer not to have to have a variable for every expression I have. Any ideas? thx :)


That's because ` in yours are in a string. So your second one needs to be:

<p [appMath]="'`a=b`'"></p>