我在 sqlserver 中存储了 mathml 格式的方程式。使用 linq,我将列表中的方程式传递给 UI。在 UI 中,我尝试使用 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.
数学字符串是
<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> </mo>
<mo>=</mo>
<mo> </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>
最佳答案
也许使用这个指令是个好主意: 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> </mo>
<mo>=</mo>
<mo> </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>
关于c# - 如何在angularjs中使用ng-repeat渲染mathml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39566102/