Has anyone gotten Mathjax working with Angular2 ?
Plunkr example created :- http://plnkr.co/edit/FLduwmtHfkCN5XPfzMsA?p=preview
From some Angular1 example
I would implement this way with an input to get the specified expression:
import {Directive, ElementRef, Input} from 'angular2/core';
@Directive({
selector: '[MathJax]'
})
export class MathJaxDirective {
@Input(' MathJax')
texExpression:string;
constructor(private el: ElementRef) {
}
ngOnChanges() {
this.el.nativeElement.innerHTML = this.texExpression;
MathJax.Hub.Queue(["Typeset", MathJax.Hub, this.el.nativeElement]);
}
}
And use this way:
See this plunkr: http://plnkr.co/edit/qBRAIxR27zK3bpo6QipY?p=preview.