No video

ANGULAR 15 REACTIVE FORM : USING FORMGROUP AND FORM CONTROL

  Рет қаралды 89,467

Techie Ocean

Techie Ocean

Күн бұрын

In this tutorial, we will see how to create reactive forms in Angular 8 using Formcontrol and FormGroup.
The basic requirement for setting up the reactive forms is importing the ReactiveFormsModule in the app.module
1.FormControl:
In FormControl, we can create the instance of the formcontrol in the component class.
For eg.
email = new FormControl('');
Here we have created a instance of the FormControl in the component class named as Email.
And in the Html, we can use the created instance for creating the html element.
We can access this FormControl in the component class to get or set the value.
For eg: this.email.setValue('test@testdomain.com');
2.FormGroup :
The FormGroup is nothing but the collection or a group of FormControls.
For eg :
userprofileForm = new FormGroup({
firstName: new FormControl(''),
lastName: new FormControl(''),
age: new FormControl(''),
email:new FormControl(''),
});
Here, we are defining a FormGroup named as "userprofileForm". In this formgroup, we have 4 controls named as firstname,lastName,
age and email.
we can declare them in the same fashion in the html .
And in the form element , we just have to name the formgroup.
eg: [formGroup]="userprofileForm"
How to access the formControl within the formgroup :
For eg:
this.userprofileForm.controls 'firstName'].value
So here we are accessing the formControl named as "firstName" in the fromgroup named as "userprofileForm".
Form Control Validation:
We have to import the Validators from the '@angular/forms' for incorporating the validators in the control.
userprofileForm = new FormGroup({
firstName: new FormControl('',Validators.required),
....
});
Here we are making the firstName formcontrol as mandatory.
The FormGroup has a inbuilt property named as valid.
eg : userprofileForm.valid
Here "userprofileForm" is the formgroup. userprofileForm.valid will be true if the form passes all the validations on the form successfully.
Else it will return false.
#Angular #Angular 8 #Angular 10 #Angular 12 #Angular 13 #Angular 15

Пікірлер: 38
@KL4NNNN
@KL4NNNN 2 жыл бұрын
hahahahahhahaha this voice cracks me up.....I cannot take it anymore hahahahahaha
@freedownload2472
@freedownload2472 4 жыл бұрын
Very Nice Good work. keep doing it
@dregavero
@dregavero 3 жыл бұрын
Nice tutorial, easy to follow, thanks! 🙂
@JoseAlvarez-dl3hm
@JoseAlvarez-dl3hm 3 жыл бұрын
Thanks a lot! That was really clear and concise.
@fernandotoledo8093
@fernandotoledo8093 4 жыл бұрын
Your voice is funny, thank you.
@mohdabdulahad1509
@mohdabdulahad1509 5 жыл бұрын
thanks for nice video kindly also try to upload the source code...appreciate your work man......thank u very much
@programacaosimplicada
@programacaosimplicada 4 жыл бұрын
Thank you very much! You are a very good teacher. Keep up the good work :)
@CodeNinja770
@CodeNinja770 3 ай бұрын
Very clear... please don't zoom screen, we r able to see clearly.
@AnarchoFuturist
@AnarchoFuturist 3 жыл бұрын
Very helpful, thank you!
@KattaDeshai
@KattaDeshai Жыл бұрын
Nice tutorial, its very clear
@rajkiran7193
@rajkiran7193 4 жыл бұрын
Really appreciated
@ravindertawni
@ravindertawni 4 жыл бұрын
I fund the video useful. Good job.
@shreyanshsrivastava3013
@shreyanshsrivastava3013 4 жыл бұрын
explained in a very easy way.
@nileshdabi7393
@nileshdabi7393 5 жыл бұрын
Good work. keep doing it
@TechieOcean
@TechieOcean 5 жыл бұрын
Thanks Nilesh.
@marceloveron2393
@marceloveron2393 3 жыл бұрын
que genio
@frossty916
@frossty916 3 жыл бұрын
thx!!!
@akshayvarve5343
@akshayvarve5343 Жыл бұрын
Damnn very clear😍
@kouverbingham5997
@kouverbingham5997 4 жыл бұрын
On the FormGroup section, what if additionally you wanted to have a cancel button, which does not submit, or does something else, like reroutes. This would also fire ngSubmit. An undesired result.
@KrishnaReddyKovvuri
@KrishnaReddyKovvuri 4 жыл бұрын
error NG8002: Can't bind to 'FormControl' since it isn't a known property of 'input'. i am getting error
@denisr.8248
@denisr.8248 2 жыл бұрын
great video but how do you bind the value to the value of fromGroup Controller for exaple the first name ?
@fahadjunaid4572
@fahadjunaid4572 4 жыл бұрын
Thanks
@rkeusgba9771
@rkeusgba9771 4 жыл бұрын
What a page has multiple rows to update how to do that and how to track what values are changed
@jesse2006
@jesse2006 4 жыл бұрын
Why do you put formgroup in square brackets but formcontrolname without square brackets?
@md.nahidhasan2864
@md.nahidhasan2864 4 жыл бұрын
WOW
@jyotimahajan997
@jyotimahajan997 4 жыл бұрын
Cannot create property 'validator' on string '6-28-2020' geeting this error when using formControl
@khusikar676
@khusikar676 2 жыл бұрын
And here I want button will enable condition base... Like if the name or email one of them is selected this button will enable.... Can u plz help meee
@arijitchakrabarty1552
@arijitchakrabarty1552 3 жыл бұрын
tried this method but every time i submit, the page reloads and there is no data in console. can u help?
@priyandarshana4830
@priyandarshana4830 4 жыл бұрын
userful
@zekariyasmulugetaaltaye1065
@zekariyasmulugetaaltaye1065 10 ай бұрын
great video. but how does no body say anything about his voice?
@sharma2029
@sharma2029 5 жыл бұрын
Using import map shows rx error.. Could you tell how to use map in angular.. What need to import
@bantasingh6386
@bantasingh6386 2 жыл бұрын
Cannot find control with unspecified name attribute
@reddyroyal8710
@reddyroyal8710 4 жыл бұрын
Instead of console, how these data post to web API?
@khusikar676
@khusikar676 2 жыл бұрын
Hiii can we do 2way data binding on reactive form... I mean... I hava a data which I fetching from api... I am display data.name but need to pass data.id when I creating new list of data... And onedit I have to set the value.... But I am not able to do tht what have to do.... Can u plz suggest???
@arslanghummann
@arslanghummann 2 жыл бұрын
define a global form control name with same name as in form group and assign the value from the data and set the value using setValue function
@jayakumar2927
@jayakumar2927 4 жыл бұрын
Share the code
@harshbhardwaj4105
@harshbhardwaj4105 4 жыл бұрын
bro your screen zooming irritates. we are not blind. humbly request you plz don't do this from now on in your videos. it degrades you traffic over video.
@musthakeem3108
@musthakeem3108 11 ай бұрын
ANGULAR 15 REACTIVE : NESTED FORM GROUP
7:35
Techie Ocean
Рет қаралды 17 М.
ANGULAR 15 REACTIVE FORM : USING FORMBUILDER
11:51
Techie Ocean
Рет қаралды 35 М.
OMG what happened??😳 filaretiki family✨ #social
01:00
Filaretiki
Рет қаралды 13 МЛН
Survive 100 Days In Nuclear Bunker, Win $500,000
32:21
MrBeast
Рет қаралды 163 МЛН
managed to catch #tiktok
00:16
Анастасия Тарасова
Рет қаралды 43 МЛН
Angular form control and form group
9:20
kudvenkat
Рет қаралды 142 М.
15 Angular Forms - FormControl | Part 1 | Angular in Tamil
15:01
UI Gems (React.js, Angular, Front end interview)
Рет қаралды 13 М.
Angular Reactive Forms - All Needed Use Cases
15:55
Monsterlessons Academy
Рет қаралды 30 М.
Angular 17 Tutorial - Build Reactive Forms #13
24:24
Programming with Umair
Рет қаралды 1,7 М.
Creating custom form controls in Angular (Control Value Accessors)
29:22
Reactive Forms  - The Basics
15:48
Fireship
Рет қаралды 256 М.
Creating and Using Reactive Forms | Angular Forms | Angular 13+
12:21
Building Forms in Angular Apps | Mosh
25:04
Programming with Mosh
Рет қаралды 418 М.
OMG what happened??😳 filaretiki family✨ #social
01:00
Filaretiki
Рет қаралды 13 МЛН