Book Image

Learning Dart, Second Edition - Second Edition

By : Ivo Balbaert
Book Image

Learning Dart, Second Edition - Second Edition

By: Ivo Balbaert

Overview of this book

Table of Contents (18 chapters)
Learning Dart Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Two-way data binding in Polymer.dart


Model Driven View (MDV) is a set of techniques to help you bind data to your views in a more direct way than we did in Chapter 6, Combining HTML5 Forms with Dart. The idea here is simple:

  • We have one or more classes (with properties) in a model

  • Our app contains one or more views (implemented as web components) to present the model's data (the data binding)

Note

For the code files of this section, refer to code\chapter_8\bank_terminal in the code bundle.

Data binding can be one-way (model to view) with or without observing the changes in the model: this means that the data from our model (a variable or a method that returns a value) is shown (read-only) on the page, and we do this by writing {{var}} on the web page and marking the var variable in code as @observable var. When its value changes, the altered value will be shown on the web page. In general, you can show any Dart expression with the {{ expression }} notation, but be careful that the expression...