Angular is it possible to detect if query Paramter has changed?
You can subscribe to the params in the root component
constructor(route:ActivatedRoute) {
route.queryParams.subscribe(p => console.log(p.myQueryParam)); // you can also do this in ngOnInit
}
See also https://angular.io/api/router/ActivatedRoute
You can have query params on other route levels as well, but then they are called matrix parameters.
See also the end of this section https://angular.io/guide/router#route-parameters-required-or-optional
You can subscribe to the params observable provided by ActivatedRoute module to observe changes in the query parameters.
constructor(private route:ActivatedRoute) {
this.route.params.subscribe(
(params:Params)=>{
console.log(params['yourId']);
};
)}