I want to show MathML
DOM object dynamically with Angularjs
.
This is what I wrote:
var mathML = angular.module('mathML', ['ngSanitize']);
mathML.controller('mathMLCtrl', ['$scope', function ($scope) {
$scope.result = function(){
return "<math xmlns='http://www.w3.org/1998/Math/MathML'><msup><msqrt><mrow><mi>a</mi><mo>+</mo><mi>b</mi></mrow></msqrt><mn>27</mn></msup></math>";
//return "<p>p tag</p>";
};
}]);
With ng-bind-html
, I can insert text as a HTML text, but MathML
's XML is not inserted properly. (All tags are deleted.)
It looks like necessary to insert MathML
text as DOM Objects. But I don't know how to do it.
How can I show MathML
with Angularjs
?