angular.js - What are the differences between controllers, services, and instructions in angularjs! Dizzy
ringa_lee
ringa_lee 2017-05-15 16:55:49
0
2
517

Like the title
What is the difference between controller, service and command in angularjs! Reading these three concepts makes me dizzy

ringa_lee
ringa_lee

ringa_lee

reply all(2)
PHPzhong

Controller is responsible for the main logic of the page. Directive is similar to the concept of web components. It takes out a part of the page and encapsulates it into a Directive that is referenced in the page through tags. A Directive contains the HTML template and business logic of this component. Service abstracts functions independently and uses them flexibly through dependency injection

洪涛

Simply can be understood as controller: controlling data interaction and simple page interaction. If page interactions become complex, they can be extracted separately and encapsulated into instructions, and the service can provide commonly used data request services. Of course, these are just the tip of the iceberg. If you dig deeper, you will find that they have far more functions than these~

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