angular - Retain the value in Global filter after refreshing the page in angular2 -
i have used data table , global filter filters data data table in angular2.i performing following operation.
when entered value in filter, records getting filtered. when perform operation(for e.g., approve record),the page gets refreshed removing particular record(as expected) , filter gets cleared.but want is,the filter should not cleared , has display records present(except deleted record) before performing action after performing approve action. able retain value in filter using ngmodel records not getting filtered.they getting filtered after focusing , press enter button or pressing key space or entering letter.
so please me in filtering data after refreshing page
you can use router query parameters filter data
get filter in constructor
constructor(private router: router, private route: activatedroute) { this.route .queryparams .subscribe(params => { const filter = params['filter'] || ''; this.applyfilter(filter); }); }
set filter
onfilter(param: string): void { this.router.navigate(['mypage'], { queryparams: { filter: param} }); }
Comments
Post a Comment