angular get router url without params code example
Example 1: angular get url param
constructor(private activatedRoute: ActivatedRoute) {
this.activatedRoute.queryParams.subscribe(params => {
let date = params['startdate'];
console.log(date);
});
}
Example 2: angular get url params
import { ActivatedRoute } from "@angular/router";
private $route: ActivatedRoute
this.$route.params.forEach(param =>
this.myvar = param['whatever your param name is']
);
Example 3: in angular how to get router url without query params
this.router.url.split('?')[0]