I want to call this backend URL to receive user profile data
/users/:userId/profile
where :userId will be an actual number for the ID.
What is the syntax to inject the userId value to the URL before sending the request?
I want to call this backend URL to receive user profile data
/users/:userId/profile
where :userId will be an actual number for the ID.
What is the syntax to inject the userId value to the URL before sending the request?
One way ( using typescript ) is to use a template string
`/users/${this.userId}/profile`
The template is surrounded by the backticks ( `` ).
The string inside the backticks can evaluate expressions when they're inside a ${...}.
The string above is the same as typing:
'/users/' + this.userId + '/profile'