angular read url parameters 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 url parameter
constructor(private activatedRoute: ActivatedRoute) {
this.activatedRoute.queryParams.subscribe(params => {
console.log(params);
});
}
Example 3: angular set url parameters
<a href="javascript:;" routerLink="/link/params">
My link
</a>
{path: '/link/:paramsName', component: MyComponent }