javascriptangularjsmathquill

How do I rerender mathquill.js?


The problem is, I'm using angularjs ng-include to load partial, and mathquill box is in the partial, if I put

<script src="/MathQuill/mathquill.js"></script>

in the partial view, it works fine, but I will get a warning:

Synchronous XMLHttpRequest on the main thread is deprecated because of its   detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

If I put

<script src="/MathQuill/mathquill.js"></script>

in the main view, after loading partial, mathquill doesn't work at all, so is this the rendering problem? How do I re-render the partial view? Or if it's not, how do I solve it?


Solution

  • Found in mathquill website:

    Note that for dynamically created elements that weren't in the HTML DOM on document ready, you will need to call our jQuery plugin after inserting into the visible HTML DOM:

    $('<span>x^2</span>').appendTo('body').mathquill() or .mathquill('editable')