From the course: Building Angular and ASP.NET Web API Apps

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Validating an Angular reactive form

Validating an Angular reactive form

From the course: Building Angular and ASP.NET Web API Apps

Start my 1-month free trial

Validating an Angular reactive form

- [Presenter] On the last part, we created the form group and we designed the form itself. On this part, we are going to work on the validation of an angular reactive form. So, let's get started. Before we proceed further, in our component.css file, I'm going to paste some CSS code. I'm not going to cover this code, because that is not the intention of our course, and you can find it in your solution files. So now that we added the CSS code, for that code to work, let us go to the HTML file, and for each form field, we need to add a class, and this class is going to be named new-entry-field. Let us do the same for the other fields as well, so paste the same line of code in line 7, and then in line fourteen, and then next, save the changes. Now, in the form, we need to have a submit function, which we are going to trigger, or we are going to use when we submit the data. So, for that let us write in here ngSubmit, and then let us define the function, or the method, to be onSubmit. Also,…

Contents