Suggest an editImprove this articleRefine the answer for “How do you get query parameters?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**Query parameters** (for example, `?page=2&sort=asc`) are obtained through the `ActivatedRoute` service - either as a one-time read via a snapshot, or by subscribing to changes. **Key point:** Angular does not reload the component, but it does track the parameters.Shown above the full answer for quick recall.Answer (EN)ImageQuery parameters (for example, `?page=2&sort=asc`) are obtained through the `ActivatedRoute` service. There are two approaches - a **one-time read** and **subscribing to changes**: --- ### 1. One-time read (snapshot) ```typescript constructor(private route: ActivatedRoute) {} ngOnInit() { const page = this.route.snapshot.queryParamMap.get('page'); const sort = this.route.snapshot.queryParamMap.get('sort'); } ``` This is simple - it takes the values at the moment the component is entered. --- ### 2. Subscription (reacting to changes) ```typescript this.route.queryParams.subscribe(params => { const page = params['page']; const sort = params['sort']; }); ``` Needed if the parameters can change while the component is active (for example, when filtering without a reload). --- **Where do query parameters come from?** From a URL like: ```javascript /products?page=2&sort=asc ``` Angular does not reload the component, but it does track the parameters.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.