Answers for "query params angular"

1

get query params from url angular

import { ActivatedRoute } from '@angular/router';

export class ExampleComponent implements OnInit {

  constructor(private router: ActivatedRoute) { }

  ngOnInit() {
    this.router.queryParams.subscribe(res=>{
      console.log(res) //will give query params as an object
    })
  }

}
Posted by: Guest on August-19-2021
0

queryparams angular

goProducts() {
  this.router.navigate(['/products'], { queryParams: { order: 'popular' } });
}
Posted by: Guest on February-27-2021
-1

get route query params angular

export class HeroComponent implements OnInit {
  constructor(private _activatedRoute: ActivatedRoute, private _router:Router) {
    _router.routerState.queryParams.subscribe(
      params => console.log('queryParams', params['st']));
Posted by: Guest on July-08-2020

Code answers related to "query params angular"

Code answers related to "Javascript"

Browse Popular Code Answers by Language