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,
- Import Router from @angular/router
import { Router } from '@angular/router';
- Inject router inside constructor
constructor(private router: Router ) {}
- Access url parameter
console.log(this.router.url); // /routename
April 27, 2022
351
Read more
What is Angular Framework?
November 04, 2022
AngularWhat is a Angular module?
November 03, 2022
AngularWhat are the steps to use animation module?
October 31, 2022
Angular