官术网_书友最值得收藏!

Data binding with custom attributes

A great use for custom data attributes is to implement data binding. Data binding allows us to map user controls in the DOM to fields in the data model so that they are automatically updated when the user changes them. Using this technique we can eliminate a lot of boring repetitive code that does nothing more than handle events and map fields in the view to fields in the model.

Note

There are a few excellent data binding libraries available for JavaScript, including Backbone.js and Knockout. We will implement our own simple data binding here to learn how to use custom attributes. If you find yourself building an application with a lot of data you might consider using one of these libraries.

主站蜘蛛池模板: 北川| 赣榆县| 舒城县| 南宁市| 英德市| 平潭县| 左云县| 策勒县| 体育| 姚安县| 黄平县| 济源市| 兴和县| 新和县| 会昌县| 桃园市| 萝北县| 怀柔区| 肇庆市| 高碑店市| 昭平县| 衢州市| 麻栗坡县| 隆尧县| 大理市| 澎湖县| 云霄县| 日土县| 清河县| 拜泉县| 长岛县| 昭苏县| 平利县| 宜黄县| 松原市| 建德市| 兰考县| 昌乐县| 洞口县| 高要市| 东宁县|