Get current route without parameters

前端 未结 12 1368
梦如初夏
梦如初夏 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:36

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

    this.url = this.url.substr(0, this.url.lastIndexOf("?"));
    

提交回复
热议问题