import { ActivatedRoute } from "@angular/router";
class Component implements OnInit {
constructor(private route: ActivatedRoute) { }
ngOnInit(){
// Route is: "product/:id"
const id = this.route.snapshot.paramMap.get("id");
}
// Caution: "If you intend to update the URL parameter within
//the same component, then you have to use a subscription."