c# - 如何在angularjs中使用ng-repeat渲染mathml?

标签 c# html .net angularjs

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

最佳答案

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

关于c# - 如何在angularjs中使用ng-repeat渲染mathml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39566102/

相关文章:

c# - 如何为 C# XML 序列化添加属性

php - 如何检测可以是日文、中文或英文的字符串的编码并转换为 utf8 以供显示?

jquery - 如何使用 jquery 将项目移动到组之间的空列表?

c# - 使函数在 Linq 函数中被调用

c# - 如何使用 C# 将 JQgrid 数据导出到 Excel?

c# - Unity2D - 如何在 2D 游戏中围绕圆移动和旋转游戏对象?

c# - Entity Framework : Unable to create a constant value of type **. 此上下文中仅支持原始类型或枚举类型

javascript - 在文本区域内查找正文元素

c# - Databind 无法通过 IBindableComponent 进行转换

c# - 服务 Controller 权限