1. 6
    Create a New Task Page with Angular CLI ng generate
    1m 20s

Create a New Task Page with Angular CLI ng generate

Jorge Vergara
InstructorJorge Vergara
Share this video with your friends

Social Share Links

Send Tweet

We need to add a new tasks page so we'll add a button on the home page and link to this new page with routerLink.

Then we'll use the Angular CLI to create a new page with ng generate. Finally we'll add the page route to our routing.module.

Instructor: [0:00] To add new tasks to our database, first, we are going to create a button here to navigate to the create task page. If we try to navigate right now to that page, we get an error because that route doesn't exist.

[0:26] We are going to go ahead and terminate our server, and we are going to create a new component for our task detail page. Now, we can see that it added that page to our module and we are going to go to our task routing module.

[0:48] We are also going to add a route with that page here. Anything that goes to tasks, it's going to go to the tasks page and anything that goes to task/ and dynamic task ID, it's going to go to our new task page component.

[1:07] Now, we can fire up our server again. If I click the plus button, I can see task work. It is taking me to the task component.