From the course: Building Angular and ASP.NET Web API Apps
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Add data validation to a registered form
From the course: Building Angular and ASP.NET Web API Apps
Add data validation to a registered form
- [Instructor] In this part, we're going to improve the errors in the signup page, and we are going to start from the component.ts file. In here, inside the class, just after the signupForm: form Group, I'm going to create a new property. Going to name it just errorMessage, and this is going to be of type either string or null. Default value is going to be just null. I'm going to use this one. Whenever I have an issue that is coming from the API side, I want to show a message on the screen. And then next, I'm going to create a helper method, which I'm going to use to check for specific errors in specific controllers. For that down here, just going to type, hasError. This will take two parameters. The first parameter is going to be the controlName, which is going to be, of course, of type string. And the second one is going to be the errorName, which is also going to be of type string. So, basically, we check, for example, for the email, if it has the error of the email format, this is…
Contents
-
-
-
-
-
-
Understanding token-based authentication3m 2s
-
(Locked)
Configure token-based authentication in ASP.NET Web API5m 49s
-
(Locked)
Build the register API endpoint11m 29s
-
(Locked)
Create the login API endpoint9m 47s
-
(Locked)
Develop the authentication service in angular8m 7s
-
(Locked)
Register for a new account15m 38s
-
(Locked)
Add data validation to a registered form11m 28s
-
(Locked)
Log in to an account6m 6s
-
(Locked)
Secure routes with Angular Guards5m 54s
-
(Locked)
Update the header for logout functionality6m 53s
-
(Locked)
Implement the auth interceptor7m 21s
-
(Locked)
Set a user ID when a transaction is created and loaded8m 28s
-
-
-