on-internet
← Community

how to keep Angular Signals and Router query params in sync without creating loops

Stack Overflow ·

I’m working on an Angular project where we have an order list with filters, pagination and sorting. All of these values should be stored in the URL, so users can share or bookmark the current view My current setup looks roughly like this: readonly query = signal<OrderQuery>({ search: '', status: 'all', page: 1, pageSize: 25, sort: 'createdAt' }); readonly orders = toSignal( toObservable(this.query).pipe( debounceTime(100), distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)), switchMap(query => this.orderService.search(query)) ), { initialValue: null } ); constructor() { thi

Comments

Sign in or sign up to comment and upvote.

No comments yet.