A good feature is that its service can automatically inject dependency: if you want to use the $http service, just declare that you want to use it.
But let's take a look at the following two ways of writing:
The first type
('messageService', function ($resource, $http) { ...
The second type
('messageService', ['$resource', '$http', function ($resource, $http) { ...
Both writing methods are fine when debugging the source code
But after packaging, the first way of writing is torn, because when packaging, the local variable name is compressed, resulting in $resource and $http being replaced with short variable name, so I don’t know what kind of service to inject
To solve this problem, the second way of writing is recommended
The above article briefly talks about the writing method of angularjs dependency service injection is all the content I share with you. I hope you can give you a reference and I hope you can support me more.