I have several links navigating as
http://localhost:4200/#/forward/services/our-services?category=1 http://localhost:4200/#/forward/services/our-services?category=2 http://localhost:4200/#/forward/services/our-services?category=3 I would like to fetch the value of category
Ive tried
this.sub = this._activatedRoute.params.subscribe(params => { this.category = + params['category']; console.log(params['category']); }); The console.log() is only printend once ,
How can i ensure i capture whenever the value of category changes
This is what am using for navigation
<ul id="menu-services-menu" class="menu" *ngFor="let category of categories"> <li><a routerLinkActive="active" [routerLink]="['/forward/services/our-services']" [queryParams]="{ category: category.category }" >{{category.category}}</a></li> </ul>