I want to get the url which comes from this:
this.router.navigate(./somepath, { relativeTo: this.route })
this.route
is of the type ActivatedRoute
.
I tried url: string = route.snapshot.url.join('');
but this gives an empty string.
You can use the activated route to get active URL.
import { ActivatedRoute } from '@angular/router';
constructor(
private activatedRoute: ActivatedRoute) {
console.log(activatedRoute.snapshot['_routerState'].url);
}