Answers for "angular path match for path parmas"

3

angular router with wuery param

goProducts() {
  this.router.navigate(['/products'], { queryParams: { order: 'popular' } });
}

http://localhost:4200/products?order=popular

 constructor(private route: ActivatedRoute) { }

  ngOnInit() {
    this.route.queryParams
      .filter(params => params.order)
      .subscribe(params => {
        console.log(params); // { order: "popular" }

        this.order = params.order;
        console.log(this.order); // popular
      }
    );
  }
Posted by: Guest on October-26-2020
5

angular [routerlink]

content_copy
      
      <a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" fragment="education">
  link to user component
</a>
Posted by: Guest on March-06-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language