Currently, I have:
ngOnInit() {
this.getPi();
}
getPi(): void {
const term = this.route.snapshot.paramMap.get('category');
console.log(term);
this.piService.getPi(this.route.snapshot.paramMap.get('term')).subscribe(pi => {
this.pi = pi;
});
}
This works fine when navigationg to localhost:4200/term1. However, when I navigate to another term (localhost:4200/term2 for example), ngOnInit doesn't get fired as no other component gets loaded.
How should I watch the changes so that I can call getPi()?