1

A lot of times, I have long forms that I divide into multiple tabbed sections. Each section is managed by it's own controller and there is a parent controller that manages the whole view. I use ui-router for dividing such sections into states.

Should I make a service instead of a controller to manage the all the sections but generally, I don't have business logic in their. It's mostly done for collection data altogether and passing it to an API using ng-resource.

I know

1

This is a good use case for a parent controller. If your tabbed panel behavior is general enough, you might consider abstracting it further into a directive. But generally there is nothing wrong with creating a top-level controller to coordinate several related child controllers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.