Angularjs Control Layer

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.