Angularjs Custom service provide provider method and factory, service method and provider vendor Concept

Source: Internet
Author: User

Angularjs Custom service provide provider method and factory, service method and provider vendor Concept
Angularjs Custom service provide provider method and factory, service method and provider supplier concept learning points: 1. provider method 2 in Angularjs. factory method 3 in Angularjs. service Method in Angularjs 4. provider vendor CONCEPT 5. when you first try Angular, services in ionic code will naturally fill the controller and scope with unnecessary logic. Be sure to realize that the controller layer should be very thin. That is to say, most of the business logic and persistent data in the application should be placed in the service. Many people ask how to save persistent data in the controller. This is not what the controller should do. For the sake of memory performance, the controller is initialized only when needed, and will be discarded once not needed. Therefore, Angular clears the current controller every time you switch or refresh the page. At the same time, the service can be used to permanently store application data, and the data can be used between different controllers. Angular provides three methods to create and register our own services. 1. Provider2. Factory3. Service1. Angularjs provider method and provider vendor concept Providers are the only service that you can upload to the. config () function. If you want to configure the module scope before the service object is enabled, you should use provider.

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.