Reactive Forms in Angular easily explained with practical example

preview_player
Показать описание
Angular Reactive Forms

Angular reactive forms, also known as model-driven forms, offers an easy way to use reactive patterns and validations. They follow the reactive programming style that supports an explicit data management flow between non-UI data models (frequently retrieved from a server) and a UI-oriented form model that keeps the states and values of HTML controls on the app screen.
When coding reactive forms, we will avoid directives like required, ngModel, NgForm and such. The idea is that we actually use the underlying APIs to do it for us. In a sense, instead binding Object models to directives like it happens in template-driven forms, we create our own instances inside a component class and build our very own JavaScript models. This approach has a lot more power and is extremely productive to work with since it allows us to write expressive code (a very testable one that keeps all the logic in the same place) instead of dividing it over different form templates.
With reactive forms, you will be able to create and manipulate form control objects directly in the Component. Since the component class has access to the form control structure and the data model, you can push data model values into the form controls as well as pull values that have been changed by the user. The component is able to observe changes in the form control state and react to them. This is specially useful for showing a validation message.
One of the advantages that working directly with form control objects brings you is that value and validity updates are always synchronous and under your control. You won’t find the timing issues that sometimes affect a template-driven form. Also, reactive forms tend to be easier to unit test.
Рекомендации по теме
Комментарии
Автор

please sir make video for select drop down, checkbox and radio button validations in angular

rushivaidya
Автор

Ek video multiple ng-content pe plz.... YouTube pe ya koi v online course me available nai hai...

shuvajitmohanty
Автор

Hi Manish,

Really thanks for this video.
I know, it is quite difficult,
But, Could you make an application this way only. (Reactive way)
With different type of controls,
Modal-popups,
parent-child relationship, etc.
Please..

AvinashKumar-mhsi
Автор

hello sir could you make user already exist server side validation thank you

motivateme