angularJs新手
请问angularJs中service,factory,controller之间的区别是什么,他们分别适用于什么地方?
为情所困2017-05-15 16:55:20
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.