In component.ts
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 metods
}
if (param === 1) {
this.onFilterByOutcome();
}
if (param === 2) {
this.onFilterByLoan();
}
if (param === 3) {
this.onFilterByInvestment();
}
});
}
//Like this
onFilterByIncome() {
this.store$.dispatch(new UsersFilterByIncomeAction());
}
I need the data coming into the component to change when the params is changed.
I tried different ways, but it didn't work out for me. With such a code as now, it does not work for me.