QueryParams Not Working With Angular2 Router v 3.4.10

221 Views Asked by At

With Router V 3.0.0 I can do this

this.router.routerState.snapshot.root.queryParams["someParameter"];

Bu I can't achieve the same with Router V 3.4.10.

Any ideas?

1

There are 1 best solutions below

0
Aman Jain On

Write in constructor of the component

constructor(private router: Router, private route: ActivatedRoute ) { this.route.queryParams.forEach((params: Params) => { let someParameter = params['someParameter']; console.log(someParameter); }); }