क्या किसी ने एंगुलर 2 के साथ काम कर रहे मथजैक्स को प्राप्त किया है?एंगुलर 2 के साथ काम कर रहे मथजैक्स को कैसे प्राप्त करें?
Plunkr उदाहरण बनाया: - http://plnkr.co/edit/FLduwmtHfkCN5XPfzMsA?p=preview
कुछ Angular1 उदाहरण मैं ऐसा लगता है कि एक निर्देश MathJax.Hub.Queue कॉल करने के लिए की जरूरत है देखा से, लेकिन मुझे लगता है कि यह मेरे लिए काफी कुछ समय लग कोणीय 2 प्राप्त करने के लिए होगा सिंटैक्स सही, तो मुझे आश्चर्य हुआ कि अगर कोई इसे पहले ही कर चुका है?
उदाहरण के लिए एक कोणीय 1 उदाहरण है। https://github.com/ColCarroll/ngMathJax/blob/master/ng-mathjax.js
और mathjax वाक्य रचना यहाँ है: - https://docs.mathjax.org/en/v1.1-latest/typeset.html
Angular2 में इसी तरह कुछ करने के लिए कोशिश कर रहा है।
अद्यतन - निम्नलिखित कार्य, थिएरी के लिए धन्यवाद।
घटक: -
import {Component, OnInit} from 'angular2/core';
import {MathJaxDirective} from './mathjax.directive';
@Component({
selector: 'hello-mathjax',
templateUrl: 'app/hello_mathjax.html',
directives: [MathJaxDirective]
})
export class HelloMathjax {
fractionString: string = 'Inside Angular one half = $\\frac 12$';
index: number = 3;
ngOnInit() {
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"MathJax"]);
}
update() {
this.fractionString = 'Inside Angular one third = $\\frac 1'+this.index+'$';
this.index++;
}
}
निर्देशक: -
import {Directive, ElementRef, Input} from 'angular2/core';
@Directive({
selector: '[MathJax]'
})
export class MathJaxDirective {
@Input('MathJax') fractionString: string;
constructor(private el: ElementRef) {
}
ngOnChanges() {
console.log('>> ngOnChanges');
this.el.nativeElement.style.backgroundColor = 'yellow';
this.el.nativeElement.innerHTML = this.fractionString;
MathJax.Hub.Queue(["Typeset",MathJax.Hub, this.el.nativeElement]);
}
}
अभी तक सुनिश्चित नहीं क्यों मुझे क़तार में दोनों स्थानों पर फिर से प्रस्तुत करना की जरूरत है।
उपरोक्त प्लंकर अब सही ढंग से प्रारंभ होता है और कोणीय मैथजेक्स को सही तरीके से प्रदर्शित करता है, लेकिन फिर भी डेटा अपडेट पर ठीक से काम नहीं कर रहा है (देखने के लिए प्लंकर बटन पर क्लिक करें)। कोई विचार ? – Robert