Hi,

I have a case where I'm not sure if I should use template driven forms or 
model driven forms. I've tried to use the model driven but I'm currently 
stuck, so maybe someone could point out a solution in model driven forms or 
maybe I should switch back to template driven forms.
I have a page with a main element on it, this element is itself contains 
sub elements which I want to edit in sub directives. But I want to save all 
the data at once on my main element. 
On the page I've created a formGroup (mainForm), with all the fields I want 
to edit on page directly. I also create subFormGroup for each directives 
and I have to initialize them in my page component, which already does not 
seems very logic to me as I would prefer that each directive create their 
own model.
The advantage of this solution is that when I do mainForm.value I have all 
the values even for directives that were not loaded (in some case I don't 
want to load all the directives.
But this becomes very complex if I add another depth level.

On the other hand if I switch back to template driven forms everything 
seems much simpler, I just have to pass as input the concerned element and 
that's it. But I really like the model driven forms.

Does any one which had to handle such case (quite common I think) have a 
good guide/example to follow?

Thanks a lot.

Best regards

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to