I know that both of ActivatedRoute.params.forEach
and ActivatedRoute.params.subscribe
will return the paramaters set into route config.
Into my configuration for example:
{ path: 'auditioning/:casterType/list', component: AuditionComponent }
When I check the parameters I do this:
this._activatedRoute.params.subscribe(
(params) => {
console.log(params) // return object of parameters
}
);
Or
this._activatedRoute.params.forEach(
(params) => {
console.log(params) // return object of parameters
}
);
When I should use forEach
or subscribe
when getting params into path
because both of them return the result what I want?
What is the best practice?