ElementRef in Angular
Angular ElementRef is a wrapper around a native DOM element. In this tutorial, let us explore how to use the ElementRef to manipulate the DOM in Angular Applications.
Angular ElementRef is a wrapper around a native DOM element. In this tutorial, let us explore how to use the ElementRef to manipulate the DOM in Angular Applications.
We can add Validators dynamically using the SetValidators or SetAsyncValidators. This method is available to FormControl, FormGroup & FormArray.
How to add Validators Dynamically using SetValidators in Angular Read More »
In this article, we will learn how to implement Cross Field validation or mult field Validation in Angular. We learned how to validate reactive forms & how to create a custom validator. Those articles showed how to validate a Single Form Control. But some times we also come across fields whose value depends on another field. For example, the following scenario’s requires us to compare two fields.
n this guide let us learn how to create a custom async validator in Angular. The creating an async validator is very similar to the Sync validators. The only difference is that the async Validators must return the result of the validation as an observable (or as Promise).
The ViewChild or ViewChildren decorators are used to Query and get the reference of the DOM element injected inside an Angular component. ViewChild returns the first matching element and ViewChildren returns all the matching elements as a QueryList of items. We can use these references to manipulate element properties in the component. To Query a DOM element(s), we must supply the query selector, which can be a string or a type as the first argument to the ViewChild or ViewChildren. The argument static determines whether the query is performed, before or after the change detection. The read option allows us to query a different token rather than the default and is useful when the element is associated with multiple types. We will learn all these in this tutorial.
Understanding ViewChild, ViewChildren & Querylist in Angular Read More »