Obtain component id from javascript


In dart we can obtain dom element through ‘querySelector’ method. But I need a reverse kind method: insert data into “dart component” element from Javascript. Is there a way to achieve that?

I have try:

html file:

  document.getElementById('mydiv').text = "HELLO";
  document.getElementById('myd').text = "HELLO";

dart component:

@Component (
  selector: 'comp',
  template: '<div #mydiv id="myd">12345</div>',
class ModelerComponent {

PS: I need that because my js library requires element id, and there is no option to port it.


Thanks to comments, I’ve solve the problem:
I place code which initializes JS library into ngOnInit() method of a component. So the js library is initialised right after an angular component.

Answered By – pswrdf

Answer Checked By – Mildred Charles (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *