- Expert Angular
- Mathieu Nayrolles Rajesh Gunasundaram Sridhar Rao
- 239字
- 2021-07-15 17:05:28
Data Binding
Data Binding is one of the core responsibilities of developers when writing code to bind data to the user interface and update changing data according to user interactions with the user interface. Angular has reduced the burden of writing large amounts of code to handle Data Binding:

Angular handles Data Binding by coordinating with templates and components. The templates provide instructions to Angular on how and what to bind. There are two types of binding in Angular: globally One-way Data Binding and Two-way Data Binding. One-way Data Binding deals with either binding data from the component to the DOM or from the DOM to the component. Two-way Data Binding deals with both sides of communication, that is, the component to the DOM and the DOM to the component.
<div>Title: {{book.title}}<br/> Enter Author Name: <input [(ngModel)]="book.author"> </div>
Here, book.title wrapped in double curly braces deals with One-way Data Binding. The value of book title, if available in the component instance, will be displayed in the view. book.author, assigned to the ngModel property of the input element, deals with Two-way Data Binding. If the component instance has a value in the author property, then it will be assigned to the input elements, and if the value is changed by the user in the input control, then the updated value will be available in the component instance.
We will learn in detail about Data Binding in Chapter 8, Template and Data Binding Syntax.
- Cocos2d Cross-Platform Game Development Cookbook(Second Edition)
- Web前端開發(fā)技術(shù):HTML、CSS、JavaScript(第3版)
- C/C++算法從菜鳥到達(dá)人
- Web全棧工程師的自我修養(yǎng)
- SAP BusinessObjects Dashboards 4.1 Cookbook
- Java編程技術(shù)與項(xiàng)目實(shí)戰(zhàn)(第2版)
- Learning Salesforce Einstein
- PhoneGap:Beginner's Guide(Third Edition)
- Learning JavaScript Data Structures and Algorithms
- 運(yùn)用后端技術(shù)處理業(yè)務(wù)邏輯(藍(lán)橋杯軟件大賽培訓(xùn)教材-Java方向)
- 持續(xù)輕量級Java EE開發(fā):編寫可測試的代碼
- Spring+Spring MVC+MyBatis從零開始學(xué)
- 深入實(shí)踐DDD:以DSL驅(qū)動復(fù)雜軟件開發(fā)
- 數(shù)據(jù)結(jié)構(gòu):Python語言描述
- Unreal Engine Game Development Cookbook