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.