From the course: Angular: Animations
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Create a 404 route view - Angular Tutorial
From the course: Angular: Animations
Solution: Create a 404 route view
(upbeat music) - [Instructor] One way to create a 404 error route view is of course to simply use Angular's routing mechanism, so here's the way I went about doing this. Inside of my routes folder, I created a new file called notfound.components.ts. Within here, I simply gave it a header in my template for 404 error page not found and then, a little message inside of the body of the view, which says the page does not exist. We export NotFoundComponent and if we go to app.module.ts, we also import NotFoundComponent from routes/notfound.component, just like we do any of the other route views that we're using. Far to the bottom of our route stack, we look to see double wildcard path and the component we serve up is of course NotFoundComponent. We'll have a look now at how this works within our project. Here, we have our project and we have our basic routes here. However, if I mistype something, there we go, 404 page not…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Verifying the animations package4m 50s
-
(Locked)
Project module configuration2m 4s
-
(Locked)
Application layout5m
-
(Locked)
Creating route view components5m 2s
-
(Locked)
Configuring project routes6m 5s
-
(Locked)
Challenge: Create a 404 route view24s
-
(Locked)
Solution: Create a 404 route view1m 35s
-
(Locked)
-
-
-
-
-