【问题标题】:how to render mathml using ng-repeat in angularjs?如何在angularjs中使用ng-repeat渲染mathml?
【发布时间】:2017-01-26 17:25:28
【问题描述】:

我在 sqlserver 中存储了 mathml 格式的方程。使用 linq 我将列表中的方程式传递给 UI。在 UI 中,我尝试使用 ng-repeat 呈现这些数学字符串,但它根本不起作用。

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>&#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>

【问题讨论】:

    标签: c# html .net angularjs


    【解决方案1】:

    也许使用这个指令是个好主意: 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>

    【讨论】:

      猜你喜欢
      • 2014-09-19
      • 2014-01-16
      • 2013-09-17
      • 2014-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-22
      • 2016-06-29
      相关资源
      最近更新 更多