html-query-plan icon indicating copy to clipboard operation
html-query-plan copied to clipboard

this.SVG causes runtime error in Angular

Open estanglerbm opened this issue 3 years ago • 0 comments

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:

  1. npm install html-query-plan
  2. Manually fix-up qp.js / qp.min.js, as above.
  3. In the component using it, add to the top: import * as QP from 'html-query-plan';
  4. In styles.scss, add: @import '~html-query-plan/css/qp.css';
  5. Add the plan with:
var container:HTMLElement | null = document.getElementById("MyContainer");
if( container ) {

	QP.showPlan( container, planXMLText );
}
  1. Make sure not to add anything else in the container (i.e. through container.innerHTML), or you lose tooltips.
  2. The build will automatically have everything needed (i.e. qp_icons).

estanglerbm avatar Mar 16 '21 21:03 estanglerbm