html-query-plan
html-query-plan copied to clipboard
this.SVG causes runtime error in Angular
The code "this.SVG =" causes runtime error when using html-query-plan in Angular.
A workaround is to comment this out in qp.js / qp.min.js. So going from this:
var SVG = this.SVG = function(element) {
to this:
var SVG = /*this.SVG =*/ function(element) {
Functionality seems the same. If this code really isn't necessary, it would be nice for the npm install to have this fix.
FYI, one way to use html-query-plan in Angular is to do:
- npm install html-query-plan
- Manually fix-up qp.js / qp.min.js, as above.
- In the component using it, add to the top:
import * as QP from 'html-query-plan';
- In styles.scss, add:
@import '~html-query-plan/css/qp.css';
- Add the plan with:
var container:HTMLElement | null = document.getElementById("MyContainer");
if( container ) {
QP.showPlan( container, planXMLText );
}
- Make sure not to add anything else in the container (i.e. through container.innerHTML), or you lose tooltips.
- The build will automatically have everything needed (i.e. qp_icons).