How to add custom HTML to an element in Dart?

I would like to add arbitrary HTML bits to the element (e.g. <span>hello</span> ). How to do it in Dart?

+7
source share
1 answer

You can add arbitrary HTML bits to an element with appendHtml('<span>some html</span>') , for example:

 import 'dart:html'; main() { var elem = new DivElement(); elem.appendHtml('<span>hello</span>'); } 

The appendHtml method will parse the HTML and add the resulting node as the last child.

+7
source

All Articles