I have a large web form where someone fills out data for servicing their
car. This form has:
- billing information
- car information
- problem information
- payment information
all within a single web form.
Currently I have it setup where there is a service, carService, which
handles all of the server interaction including loading form defaults.
My web form currently looks as follows:
<div ng-app="carApp">
<div ng-controller="ParentCtrl">
<div ng-controller="BillingCtrl">
<div ng-include src="''views/shipping.html"></div>
</div>
<div ng-controller="CarCtrl">
<div ng-include src="''views/car.html"></div>
</div>
<div ng-controller="ProblemCtrl>
<div ng-include src="''views/problem.html"></div>
</div>
<div ng-controller="PaymentCtrl">
<div ng-include src="''views/payment.html"></div>
</div>
</div>
</div>
ParentCtrl is the the controller which mainly communicates with the
carService to send/retrieve data from my server while the other controllers
are mainly used for custom $watches and $on statements looking for
broadcasts from the service to trigger UI updates. Since all the other
controllers inheret ParentCtrl's scope they technically have access to all
the data loaded via the service.
My question is, is this overkill? Should I just have one Controller for
this form?
--
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.