in angular how to get router url without query params

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

Source

Also in JavaScript: