TNG / ngqp

Declaratively synchronize form controls with the URL

Home Page:https://tng.github.io/ngqp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Synchronize router based on manual trigger

dev054 opened this issue · comments

Hello, thanks for this great library, it's awesome! I'm about to use it in a new project, however my requirement is to synchronize filters in a table based on submit button. Is there any way to accomplish this? I thought something like { updateOn: 'submit' } from FormBuilder, but I couldn't find anything similar on documentation. Thanks in advance.

Thanks for opening this issue. I'm currently recovering from an illness and on vacation, so unfortunately I can't look into this in detail quite yet, but I will definitely do so once I am back!

In general this is something I've had in mind but so far explicitly excluded since most of the complexity of ngqp wouldn't be needed for this — setting and reading parameters once is pretty easy, problems like debounce and syncing don't really occur. That said I can see why it would be nice if ngqp supported that for convenience reasons. Also ngqp just evolved since this decision was made and there would be some benefits to supporting this now for sure.

I am, however, a bit unsure of the "submit trigger" idea since ngqp currently doesn't need to deal with surrounding forms or form submission at all. An API to disable automatic syncing and trigger it explicitly, however, might be fairly easy to introduce.

A possible workaround at the moment might be to provide a custom router adapter that proxies everything to only happen on a defined trigger (I'll get more info this when I'm back).

Sorry for the late reply – my illness took longer than anticipated and this fell off my radar. I was just reminded of this in #180, and here's a prototype of the workaround I mentioned: https://stackblitz.com/edit/angular-ivy-hgjj6l?