5.7: Member Profile
We'll now work on a new part of our page where users can view details about an individual user.
Adding UserService Method
First, let's add a method in our service to get an individual user.
In user.service.ts
add the following method to get an individual user:
Generating MemberDetailComponent
In the root of your SPA
project, generate a new component with the following command:
Updating the Component
In the newly created member-detail.component.ts
, update it to the following:
In the load user method, we're using ActivatedRoute
's snapshot function to get the parameter of the url. This will be the id of the individual user that we need to query our API.
Add the MemberDetailComponent to the Routes Module
In routes.ts
, add a path to the MemberDetailComponent
:
Add a Router Link in the MemberCardComponent
A user will access the profile page from the cards, so let's add a router link to our cards.
In member-card.component.html
, add a router link to the first button with the fa-user icon:
Last updated