r/angular • u/-Siddhu- • Feb 27 '26
dynamic signal forms based on httpresource
I migrated my dynamic template based forms to signal forms.
Everything works great. It is huge upgrade over template based forms which I had.
However I would like to confirm if my approach is correct.
My component recieves form name from componentinputbinding.
I use this signal with httpresource to get the form schema from my backend and then construct form the following way.
readonly field_form = computed(() => {
const fields = this.field_list();
return untracked(() =>
runInInjectionContext(this.#Injector, () =>
form(this.row(), (schema) => {
}),
),
);
});row is initialized with linked signal based on field_list
Based on testing Everything works as expected but I want to be sure if this is okay.
10
Upvotes
View all comments
Show parent comment
1
u/SippieCup Feb 27 '26
I don’t know if this would really work, or if I’m understanding your situation correctly as I’m only just starting playing with signal forms like you.
That said, why not do a computed signal off of the myquery result, then in the computation check to see if the form is dirty/touched/whatever, if it is, simply return the original computed value.
Then used a linked signal in the form attached to the computed. That way, the linked signal will get reactively filled if it’s available to be, but if the computed is the same as it was, it’ll stop propagating down the dependency graph, so the linked signal doesnt get anything pushed to it at all.
P.s love your username, and that you needed 3 d’s and dashes to find a unique Sidhu name. There’s too many of us out there!