Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Angular

You're reading from   Learning Angular A no-nonsense beginner's guide to building web applications with Angular 10 and TypeScript

Arrow left icon
Product type Paperback
Published in Sep 2020
Publisher Packt
ISBN-13 9781839210662
Length 430 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Aristeidis Bampakos Aristeidis Bampakos
Author Profile Icon Aristeidis Bampakos
Aristeidis Bampakos
Pablo Deeleman Pablo Deeleman
Author Profile Icon Pablo Deeleman
Pablo Deeleman
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Section 1: Getting Started with Angular
2. Chapter 1: Building Your First Angular App FREE CHAPTER 3. Chapter 2: Introduction to TypeScript 4. Section 2: Components – the Basic Building Blocks of an Angular App
5. Chapter 3: Component Interaction and Inter-Communication 6. Chapter 4: Enhance Components with Pipes and Directives 7. Chapter 5: Structure an Angular App 8. Chapter 6: Enrich Components with Asynchronous Data Services 9. Section 3: User Experience and Testability
10. Chapter 7: Navigate through Components with Routing 11. Chapter 8: Orchestrating Validation Experiences in Forms 12. Chapter 9: Introduction to Angular Material 13. Chapter 10: Giving Motion to Components with Animations 14. Chapter 11: Unit test an Angular App 15. Section 4: Deployment and Practice
16. Chapter 12: Bringing an Angular App to Production 17. Chapter 13: Develop a Real-World Angular App 18. Other Books You May Enjoy

Watching state changes and being reactive

So far, we have learned how to create forms programmatically and how to specify all our fields and their validations in the code. A reactive form can listen to changes in the controls of the form when they happen and react accordingly. A suitable reaction could be to disable/enable a control, provide a visual hint, or something else according to your needs. You get the idea.

How can we make this happen? Well, a FormControl instance contains two observable properties: statusChanges and valueChanges. The first one notifies us when the status of the control changes, such as going from invalid to valid. On the other hand, the second one notifies us when the value of the control changes. Let's explore this one in more detail, using an example.

The password field in the ReactiveLoginComponent form contains a validator to check the minimum length of the value entered by the user. From an end user point of view, it would be better to display...

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 €18.99/month. Cancel anytime