InterviewHubPRO
Section Overview
Q271

Question 271 of 283

Part 10: Reactive Forms, Standalone Components, Signals & NgRx (256 - 283)

96%
Angular & Signals (283 Qs)•Part 10: Reactive Forms, Standalone Components, Signals & NgRx (256 - 283)

How do you get the current route?

In Angular, there is an url property of router package to get the current route. You need to follow the below few steps,

  1. Import Router from @angular/router
js
 import { Router } from '@angular/router';
  1. Inject router inside constructor
js
constructor(private router: Router ) {

}
  1. Access url parameter
js
 console.log(this.router.url); //  /routename