Create a custom email validator with regex.
- [Instructor] Just like we created a custom…validator for password matching,…we will create one for email formatting as well.…Let's begin by creating a new email validation…function below our matching fields function.…(typing)…We'll call it email valid.…And we will return a function that takes…a form control object.…Which I'll call control.…(typing)…We will need to create a regular expression…that will define our expected email format.…
In order to get the regular expression,…I just did a search for email rejects online.…And I just grabbed the JavaScript version…from email rejects.com.…Next let's create a rejects variable,…and paste that in.…Then we will use a JavaScript rejects test function…to test against the email itself.…We will use an inline condition…and return null if the email…checks out against the rejects,…or an error object if it does not.…
(typing)…Now that we have our email validator,…let's plug it in to our form group.…Instead of passing in a single validator in our email,…let's pass in a list.…So I'll select the current validator from our email,…
Author
Updated
4/4/2019Released
5/16/2017- Setting up the infrastructure
- Displaying data in Angular 2
- Refining your layout with Angular Material
- Getting your data from Node.js
- Saving data to a list
- Creating the component
- Getting your input data
- Creating reactive forms in Angular
- Creating a security middleware
Skill Level Intermediate
Duration
Views
Q: This course was updated on 10/17/2017. What changed?
A: We updated five videos to reflect changes to the setup and data retrieval and display processes in Angular 2. For example, instead of using a Git Angular template, the updated course uses the Angular CLI to generate a starting template, for a smooth runtime experience.
Related Courses
-
Angular Testing and Debugging
with Derek Peruo1h 16m Intermediate
-
Introduction
-
Welcome1m 7s
-
Using the exercise files1m 32s
-
-
1. Setting Up the Infrastructure
-
Demo application overview1m 10s
-
-
2. Displaying Data in Angular 2
-
Creating the component6m 24s
-
Show our data3m 22s
-
-
3. Getting Your Data from Node
-
Set up express3m 10s
-
Create a service2m 42s
-
-
4. Saving Your Data to Node
-
Create a post service3m 39s
-
Save data to a list1m 20s
-
Creating an express router2m 54s
-
-
5. Creating a Form in Angular
-
Creating the component6m 49s
-
Get our input data5m 17s
-
-
6. Navigating with Router
-
Create a nav bar2m 44s
-
Set up routes4m 10s
-
Add a messages route2m 49s
-
Pass a route parameter3m 40s
-
Retrieve a route parameter1m 17s
-
-
7. Reactive Programming
-
HTTP get with Observable6m 14s
-
-
8. Creating Reactive Forms in Angular
-
Create a register layout5m 29s
-
Validate with reactive forms7m 21s
-
-
9. Registering Users
-
Store a token with Angular1m 43s
-
Log out2m 45s
-
10. Logging In
-
Create the login services6m 47s
-
11. Authorizing Resources
-
Edit user Info7m 45s
-
Update message posting1m 26s
-
Conclusion
-
Next steps18s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Validate emails with a custom validator