Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting Started with Angular - Second edition - Second Edition

You're reading from  Getting Started with Angular - Second edition - Second Edition

Product type Book
Published in Feb 2017
Publisher Packt
ISBN-13 9781787125278
Pages 278 pages
Edition 2nd Edition
Languages
Author (1):
Minko Gechev Minko Gechev
Profile icon Minko Gechev

Table of Contents (16) Chapters

Getting Started with Angular Second Edition
Credits
Foreword
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
1. Get Going with Angular 2. The Building Blocks of an Angular Application 3. TypeScript Crash Course 4. Getting Started with Angular Components and Directives 5. Dependency Injection in Angular 6. Working with the Angular Router and Forms 7. Explaining Pipes and Communicating with RESTful Services 8. Tooling and Development Experience

Two-way data binding with Angular


One of the most famous rumors about Angular 2 was that the two-way data binding functionality was removed because of the enforced unidirectional data flow. This is not exactly true; the Angular's form module implements a directive with the selector [(ngModel)] (we'll also refer to this directive as NgModel, because of the name of its controller), which allows us to easily achieve data binding in two directions: from the view to the model and from the model to the view.

Let's take a look at the following simple component:

// ch6/ts/simple-two-way-data-binding/app.ts 
 
import {Component, NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {FormsModule} from '@angular/forms';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';

@Component({
 selector: 'app',
 template: `
  <input type="text" [(ngModel)]="name">
  <div>{{name}}...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}