Is it possible to create a Polymer element without Html? Is it possible to create a Polymer element without Html? dart dart

Is it possible to create a Polymer element without Html?


You can write a manual data binding like this:

   changes.listen((changes) {     for (var change in changes) {        if (change.name == #counter) {           myDivElement.text = change.newValue;        }     }   });

changes is a property of the Observable class, which PolymerElement mixes in. (This is difficult to see in the API reference, as it currently doesn't show a class' mixins or the mixed in properties and methods.)

Polymer seems to be mostly about enabling declarative html based bindings. It may be worth exploring using custom elements and shadow dom directly, as you're not really using polymer for anything in this example. To do this you need to change the class definition to:

   class TuteStopWatch extends HtmlElement with Observable {     ...   }

And register your element with document.register(). You also need to include the polymer.js polyfill for custom elements.