O'Reilly logo

Dart: Scalable Application Development by Ivo Balbaert, Sergey Akopkokhyants, Davy Mitchell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Binding to a checkbox

In this recipe, we will show you how to bind an input value from a checkbox to a variable; so in effect, we now perform data binding from the UI to the code and have two-way data binding. You can find the code in the project pol_check.

How to do it...

  1. The script starts with web\index.html, where a component with the name pol-check is imported through the following line:
    <link rel="import"href="pol_check.html">

    From this, we know that the component is defined in pol_check.html, and the code behind it is in a file named pol_check.dart. For a discussion of the other tags, refer to the first recipe.

  2. The code for pol-check is defined in pol_check.dart:
    import'package:polymer/polymer.dart'; @CustomTag('pol-check') classPolcheck extends ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required