How to use jqmath script in angular application?

248 Views Asked by At

I'm developing a Quiz application where i want to use jqMath script to display the maths equations. Problem is that there is syntax conflict whenever i use curly braces other than that all equation format are working fine. I have tried interpolation provider but its still the same. How can i solve this. please help!

Uncaught Error: Template parse errors:Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) (" Invalid ICU message. Missing '}'. ("

import {parseMath} from 'jqmath';

export class A{
  
  @ViewChild('exp') exp:ElementRef;
  
  func{
    var  exp = this.exp.nativeElement;     
    parseMath(exp);
  }
  
}
<div class="exp" #exp >$$x={-b±√{b^2-4ac}}/{2a}$$</div>

1

There are 1 best solutions below

2
Dave Barton On

I haven't used angular, but it appears that it is triggered by double curly braces. To avoid this, try putting a space between the two braces, i.e. { { for {{, or } } for }}. jqMath will ignore the space inside mathematics.