How to navigate dynamically to path or page from ts(class)? Basic angular interview question

Anil Kumar
Jun 7, 2023

--

Photo by Stephen Leonardi on Unsplash

To navigate programmatically you need inject router service then call navigate function

import {Router} from '@angular/common/router'
.
.
.

constructor(private router: Router){}
.....
//in some method
....
.
.
.
this.router.navigate(['/property']);

--

--