- 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.
- HTML5+CSS3王者歸來
- Progressive Web Apps with React
- Testing with JUnit
- 微服務與事件驅(qū)動架構
- Game Programming Using Qt Beginner's Guide
- iOS開發(fā)實戰(zhàn):從零基礎到App Store上架
- HTML5從入門到精通 (第2版)
- Fast Data Processing with Spark(Second Edition)
- Unity&VR游戲美術設計實戰(zhàn)
- JavaScript程序設計:基礎·PHP·XML
- 貫通Tomcat開發(fā)
- Getting Started with React VR
- 嵌入式Linux C語言程序設計基礎教程
- 一步一步學Spring Boot:微服務項目實戰(zhàn)(第2版)
- Java EE輕量級解決方案:S2SH