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

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.

主站蜘蛛池模板: 长顺县| 崇义县| 贡觉县| 礼泉县| 仁寿县| 嵊州市| 错那县| 讷河市| 昭苏县| 肇源县| 贡觉县| 阜平县| 安阳市| 庆城县| 库伦旗| 桑植县| 黔西县| 三原县| 阿巴嘎旗| 蓬安县| 舒兰市| 宜昌市| 嵩明县| 开远市| 怀仁县| 静海县| 依兰县| 石景山区| 新巴尔虎右旗| 古丈县| 武宁县| 如皋市| 景宁| 西城区| 岱山县| 林口县| 西盟| 红安县| 汪清县| 新干县| 边坝县|