Suggest an editImprove this articleRefine the answer for “What does UrlTree do?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**UrlTree** is an object representation of a URL in Angular, not just a string, used for building routes programmatically, checking access through guards, and navigating without string paths. **Key point:** UrlTree is a structured way to describe a route that Angular can read, compare, or apply.Shown above the full answer for quick recall.Answer (EN)Image`UrlTree` is an **object representation of a URL in Angular**, not just a string. It is needed for: - **building routes programmatically**, - **checking access through guards**, - **navigating without string paths**. --- ### Where it's used: 1. In guards (`CanActivate`, `CanLoad`) - you can return a `UrlTree` to **redirect the user**: ```ts canActivate(): UrlTree { return this.router.parseUrl('/login'); } ``` 2. During programmatic navigation: ```ts const tree = this.router.createUrlTree(['/user', 42]); this.router.navigateByUrl(tree); ``` --- **Summary:** `UrlTree` is a **structured way to describe a route**, which Angular can read, compare, or apply - like a navigation map, but as an object.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.