Angular Drawflow: How to drop component as node

358 Views Asked by At

Is it possible to make the click event working for template strings like this?

const htmlTemplate = `
  <div>
   <div>
     <textarea df-template></textarea>
       <button (click)="test()" class="btn-submit">Add Image</button>
   </div>
  </div>
`;

and pass it to drawflow editor.addNode()

const nodeId = this.editor.addNode(
 this.selectedItem.name,
 this.selectedItem.inputs,
 this.selectedItem.outputs,
 pos_x,
 pos_y,
 'template',
 data,
 htmlTemplate,
 false
);

and is it possible to pass a component inside editor.addNode()? thanks!

1

There are 1 best solutions below

0
Matthieu Riegler On

No this won't work. Drawflow is not an angular specific library and won't compile the template you pass to it neither will you be able to pass a component to it.

If you want to listening to click you'll be required to use the native methods : document.getElementById (for example) and addEventListener.