angular.js - 如何理解$provide、provider、$compileProvider等等相关服务
淡淡烟草味
淡淡烟草味 2017-05-15 17:03:57
0
1
599

两个代码段的功能是一样的,不同写法主要有什么区别?
$provide,provider,$compileProvider,$controllerProvider,$filterPrivoder,这几个的概念用法区分?

淡淡烟草味
淡淡烟草味

reply all(1)
小葫芦

I think you want to ask about the role of Provider.
$provide and $compileProvider in your example are all angular’s ​​internal Providers.
If you are smart, you have already seen that the call of Provider is in the config. Then you also guessed that the Provider is the configuration of the current application.
Directive, factory and other modules can be reused in multiple projects, but the environment of each project is different. Calling Provider can configure the environment of the current project.
For example, when configuring routing, routeProvider is called in config to configure the routing of the project. Each project is different; httpProvider configures the behavior and return content of $http, locationProvider configures whether routing uses #, and so on.
Custom providers only need to inject (provider name) Provider into the config to call the provider's method.
By the way, the integrated provider also has a delegate method. If the current project's service requires special functions, it can be added through this, and it will not affect the original service.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!