1. 10
    Navigate Users to a Tasks Detail Page and Load Task via Route Param
    3m 44s

Navigate Users to a Tasks Detail Page and Load Task via Route Param

InstructorJorge Vergara

Share this video with your friends

Send Tweet

We'll navigate our users to a task's detail page. To do so we want to reuse the task page that we built for creating new tasks. The difference here is we'll check the route if it includes a task Id, if it does we will grab that task from our database.

To do this we will use Angular's ActivatedRoute class in the ngOnInit lifecycle method to decide when to show the form for creating a new task, and when to populate it with an existing task's data.

Firebase gives us a handy docData function that we can access the task data via the id and subscribe to it.