blog.logrocket.com

How to use form builders in Angular 8 to validate reactive forms

Previously, we discussed how to manage reactive form controls with form groups in Angular 8. This is a new post on building reactive forms in Angular 8. Here’s a brief recap of the concepts we discussed in the last post. Forms controls and form groups in Angular Form controls are basically classes that can hold both the data values and the validation information of any form element, which means to say every form input you have in a reactive form should be bound by a form control. They are the basic units that make up reactive forms. Form...

programmer group

Simple Implementation of Angular-like Dependency Injection

Dependency injection is an important design pattern. It is so widely used that almost everyone abbreviates it as DI.Angular has its own dependency injection framework. Without it, you can hardly build an Angular application. Here's a simple (only about 100 lines of code) way to implement dependency injection like Angular. Let's start with an example // a.service.ts @Injectable() export class AService { constructor() { } public doSomething() { console.log('this is AService::doSomething'); } } //...