I have a Custom directive that renders strings with latex using MathJax.js,
here's the code.
MathJax.Hub.Config({
skipStartupTypeset: true,
tex2jax: {
inlineMath: [['$','$'], ['\\(','\\)']],
processEscapes: true
}
});
MathJax.Hub.Configured();
angular.module('mathjaxModule', [])
.directive("mathjaxBind", function() {
return {
restrict: "A",
controller: ["$scope", "$element", "$attrs", function($scope, $element,
$attrs) {
$scope.$watch($attrs.mathjaxBind, function(value) {
$element.text(value == undefined ? "" : value);
MathJax.Hub.Queue(["Typeset", MathJax.Hub, $element[0]]);
});
}]
};
});
and you use it like this:
<span mathjax-bind="textToRender"></span>
This directive is very convenient because I can combine text with MathJax
expressions, and as long as the math expressions are involved with $$,
everything renders fine. Text as text and math expressions using MathJax.
The problem is that some of those strings include also HTML, and I can't
seem to use ng-bind-html when I'm using my custom directive.
I tried something like this without success: <span
mathjax-bind="textToRender" ng-bind-html="textToRender"></span>
Maybe I'm misunderstanding the concept. How could I solve this problem?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.