Within the component.ts
file:
export class TabsComponent implements OnInit {
constructor(
private store$: Store<UsersState>,
private router: ActivatedRoute
) {}
ngOnInit(): void {
this.onFilterByIncome();
this.router.queryParams.subscribe((params) => {
const param = params['tab'];
console.log(param);
if (param === 0) {
this.onFilterByIncome(); //dispatch methods
}
if (param === 1) {
this.onFilterByOutcome();
}
if (param === 2) {
this.onFilterByLoan();
}
if (param === 3) {
this.onFilterByInvestment();
}
});
}
//As shown here
onFilterByIncome() {
this.store$.dispatch(new UsersFilterByIncomeAction());
}
The component should update its data based on changes in the query parameters.
I have attempted various solutions, but none have been successful so far. The current code is not functioning as expected.