Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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
Angular for Enterprise-Ready Web Applications

You're reading from   Angular for Enterprise-Ready Web Applications Build and deliver production-grade and cloud-scale evergreen web apps with Angular 9 and beyond

Arrow left icon
Product type Paperback
Published in May 2020
Publisher Packt
ISBN-13 9781838648800
Length 824 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Doguhan Uluca Doguhan Uluca
Author Profile Icon Doguhan Uluca
Doguhan Uluca
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Introduction to Angular and Its Concepts 2. Setting Up Your Development Environment FREE CHAPTER 3. Creating a Basic Angular App 4. Automated Testing, CI, and Release to Production 5. Delivering High-Quality UX with Material 6. Forms, Observables, and Subjects 7. Creating a Router-First Line-of-Business App 8. Designing Authentication and Authorization 9. DevOps Using Docker 10. RESTful APIs and Full-Stack Implementation 11. Recipes – Reusability, Routing, and Caching 12. Recipes – Master/Detail, Data Tables, and NgRx 13. Highly Available Cloud Infrastructure on AWS 14. Google Analytics and Advanced Cloud Ops 15. Another Book You May Enjoy
16. Index
Appendix A: Debugging Angular 1. Appendix B: Angular Cheat Sheet

Input masking

Masking user input is an input UX tool, as well as a data quality one. I'm a fan of the ngx-mask library, which makes it really easy to implement input masking in Angular. We will demonstrate input masking by updating the phone number input field so we can ensure that users input a valid phone number, as shown in the following screenshot:

Figure 11.11: Phone number field with input masking

Set up your input masking as follows:

  1. Install the library via npm with npm i ngx-mask.
  2. Import the forRoot module:
    src/app/app.module.ts
    export const options: Partial<IConfig> | (() => Partial<IConfig>) = {
      showMaskTyped: true,
    }
    @NgModule({
      imports: [
        ...
        NgxMaskModule.forRoot(options),
      ]
    })
    
  3. Import the module in the user feature module as well:
    src/app/user/user.module.ts
    @NgModule({
      imports: [
        ...
        NgxMaskModule.forChild(),
      ]
    })
    
  4. Update the number field in...
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 $19.99/month. Cancel anytime