angular.js - angularjs 中 控制器,服务,指令3者的区别是什么啊!晕晕的
ringa_lee
ringa_lee 2017-05-15 16:55:49
0
2
486

如题
angularjs 中 控制器,服务,指令3者的区别是什么啊!看书这三个概念好晕

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