I need to get my current route without params in Angular 2, I found a way to get the current route with params as follows:
this.router.url
and then split it:
this.router.url.split(';')[0]
But this looks as workaround, I think there should be better way?
parseTree
from Router
helps fetching the segments without any knowledge about url structure.
import { Router } from '@angular/router';
...
constructor(private router: Router) {}
...
const urlTree = this.router.parseUrl(url);
const urlWithoutParams = urlTree.root.children['primary'].segments.map(it => it.path).join('/');
Start from here. If you have secondary outlets adjust as required.