I want to concatenate two string in angular 7.
the function is:
getEmployment(id: number): Observable<Employment> {
const url = '${this.EmploymentUrl}/${id}';
return this.http.get<Employment>(url).pipe(
tap(_ => this.log('fetched employment id=${id}')),
catchError(this.handleError<Employment>('getEmployment id=${id}'))
);
}
However, when I inspect element in my web browser it shows that {id} is not found.
If I replace the second line with the following it works just fine.
const url = this.EmploymentUrl + '/' + id;
After a lot of googling I can't figure out why the first method doesn't work. Why doesn't it work and what is the difference between the two methods?