angular.js - What are the differences and applicable scenarios between service, factory and controller in angularJs?
漂亮男人
漂亮男人 2017-05-15 16:53:20
0
1
736

New to angularJs
What are the differences between service, factory, and controller in angularJs, and where do they apply?

漂亮男人
漂亮男人

reply all(1)
为情所困

Controller focuses on business scenarios, that is, serving specific scenarios, so do not reuse controllers. It is recommended to divide controllers in a small range and use parent-child scopes to meet business scenarios.

factory provides some public methods and functions, it is recommended to abstract and reuse factory.

Service is similar to factory. It will be instantiated and can save data. It is used as a communication tool between controllers and is recommended for reuse.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template