This story is unavailable.

Thanks Daniel, I used to structure things like this and just wanted to share my findings of this structure at scale. I found that eventually this can get a little out of hand and your master factory becomes bloated and becomes hard to decipher what models your controllers are actually referencing etc, my solution was to have a data model structure similar to your child factories all of these inherited from an abstract model which contained all of the reusable functions and stores. Then each model also had a resource service, named the same which handled all of the http methods, usually this was empty as it inherited from an abstract resource which included all of your basic http methods. This creates a nice reusable API as you suggest for all your models to interact with their resources. You then only need to inject your model into each controller that needs it.

This keeps everything DRY and at the same time achieves quite a declarative structure in your controllers/models rather than abstracting everything into a master factory.

For handling user interaction such as form submissions etc I use services which you pass your model to from within your form submission. The form service can then act on updating your model and resource and at the same time create a unified way to handle errors and interaction hooks.

It scales nicely and keeps that ability to share data between controllers on any level. Especially useful when you componentise your whole app via directives.