In the novice angular, often write a lot of code in the control layer, everything can be written in the control layer will be written in the control layer
Ways to Solve (God like)
In the control layer responsibility grooming:
1. Responsible for UI-related data initialization
2. Responsible for data communication between different modules
3. Logic handling for UI interaction
Abstraction of basic behavior
1. The template method pattern can be used to abstract a common controller initialization process into a series of standard initialization methods. Sub-classes make different methods of replication based on the actual type method
Encapsulation of common functions
1. On the basis of the original function of the package
2. Provide a quick interface for global event registration and destruction
3. Provide quick interface for model acquisition, etc.
4. Provide internal registration properties, methods and other mechanisms
Combination of different responsibilities and functional components
1. Business Components
2.UI components
3.Directive, etc.
Angularjs Control Layer