2016-09-19 24 views
0

我有存储在sqlserver中的mathml格式的方程。使用LINQ我将列表中的方程式传递给UI。在UI中,我试图使用ng-repeat呈现这些mathml字符串,但它根本不起作用。如何在angularjs中使用ng-repeat呈现mathml?

when i am directly putting the mathml string inside any div its rendering equations correctly.

In ng-repeat it showing the mathml format as it is.

MATHML串

<math xmlns="http://www.w3.org/1998/Math/MathML"> 
    <mroot> 
     <mn>4</mn> 
     <mn>2</mn> 
    </mroot> 
    <mo>+</mo> 
    <mfrac> 
     <mn>5</mn> 
     <mn>2</mn> 
    </mfrac> 
    <mo>&#xA0;</mo> 
    <mo>=</mo> 
    <mo>&#xA0;</mo> 
    <mfenced open="[" close="]"> 
     <mtable> 
      <mtr> 
       <mtd> 
        <mn>2</mn> 
       </mtd> 
       <mtd> 
        <mn>2</mn> 
       </mtd> 
      </mtr> 
      <mtr> 
       <mtd> 
        <mn>8</mn> 
       </mtd> 
       <mtd> 
        <mn>4</mn> 
       </mtd> 
      </mtr> 
     </mtable> 
    </mfenced> 
</math> 

回答

0

也许这是一个好主意,使用此指令: ngMathJax

的它会如何工作的一个例子:

<div ng-math-jax> 
 
<math xmlns="http://www.w3.org/1998/Math/MathML"> 
 
    <mroot> 
 
     <mn>4</mn> 
 
     <mn>2</mn> 
 
    </mroot> 
 
    <mo>+</mo> 
 
    <mfrac> 
 
     <mn>5</mn> 
 
     <mn>2</mn> 
 
    </mfrac> 
 
    <mo>&#xA0;</mo> 
 
    <mo>=</mo> 
 
    <mo>&#xA0;</mo> 
 
    <mfenced open="[" close="]"> 
 
     <mtable> 
 
      <mtr> 
 
       <mtd> 
 
        <mn>2</mn> 
 
       </mtd> 
 
       <mtd> 
 
        <mn>2</mn> 
 
       </mtd> 
 
      </mtr> 
 
      <mtr> 
 
       <mtd> 
 
        <mn>8</mn> 
 
       </mtd> 
 
       <mtd> 
 
        <mn>4</mn> 
 
       </mtd> 
 
      </mtr> 
 
     </mtable> 
 
    </mfenced> 
 
</math> 
 
</div>