Redirection After Creating an Account

In this lesson, we'll learn how to redirect the user after they've signed up.

Where do we go from here? There are a couple of things that we need to take care of.

  1. Redirect the user after they’ve created an account because Firebase authenticates them.
  2. Handle a scenario in which Firebase throws an error.

We’ll take care of the first scenario in which the user successfully created an account. Let’s redirect them to a page that only authenticated users should be able to view.

New route

We’ll need to create a new component to display the secret content. In the command line, run the following command:

ng generate component secret

We aren’t going to make changes to the component. The default content generated works fine as is. However, we will register a new route. In the app-routing.module.ts file, we’ll add a new path to the routes variable.

Get hands-on with 1300+ tech skills courses.