Get current route without parameters

前端 未结 12 1424
梦如初夏
梦如初夏 2021-01-01 09:08

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

12条回答
  •  醉酒成梦
    2021-01-01 09:37

    To get current route without query parameters, you can use below mentioned single line:

    this.router.url.split('?')[0] 
    

提交回复
热议问题