Web components with Polymer.dart
The Polymer.dart
framework provides a set of Polymer (UI and other) components, but it will only work in the most recent versions of browsers: IE9, IE10, Safari 6, Firefox, and the latest Chrome (also for Android). It is important that in Polymer you can only have a single Dart script tag on an HTML document. Get started with creating a new Polymer application polymer1 by selecting the project template Web application (using the polymer
library) in Dart Editor:
Inspecting pubspec.yaml
will reveal the polymer dependency:
dependencies: polymer: any
Pub is invoked automatically, and installs polymer and a whole group of packages needed by polymer (such as mdv
, observe
, polymer_expressions
, shadow_dom
, and so on). We'll now examine in detail how a web component is defined in Polymer.
Declaring and instantiating a web component
This is what we see when
polymer1.html
file is run: again a counter button, defined as a web component (also called...