Currently, I am attempting to retrieve information from my server using the object's ID.
The ID can be found in the URL as well:
http://xyz/detail/5ee8cb8398e9a44d0df65455
In order to achieve this, I have implemented the following code in xyz.component.ts:
getEx(): void {
let id:string = +this.route.snapshot.paramMap.get('id');
const x = this.exService.getEx(id)
.subscribe(ex => this.ex = ex);
}
However, this approach is not successful because paramMap.get returns a number instead of a string.
Type 'number' is not assignable to type 'string'.ts(2322)
The latter part of my URL is clearly a string, so how can I extract this string?
I appreciate your assistance!