In AngularJs, there are basically 3 ways to
minify (inject dependencies) your angular projects and scripts.
If we are using inline or injector annotations in angular project then you don't wary over the projects minify problems. Its automatically
handle all the minify problems.
In AngularJs, inline array annotations
development techniques are most popular now days and you should avoid to use to
implicit dependency injection in angular projects.
Step
-1.
In the first step, we can use the inline array
annotations. i.e.
app.controller('MainCtrl', ["$scope", function ($scope) { }]);
The
above line of code handle the minification automatically.
Step
-2.
In the second step, we can use the injector($inject)
property annotations. i.e.
var mainCtrl = function
($scope) { });
mainCtrl.$inject
= ['$scope'];
app.controller('mainCtrl', mainCtrl);
The above line of code handle the minification automatically.
Step
-3.
In the 3rd step, we can use the implicitly function parameter
names. i.e.
app.controller('mainCtrl', function ($scope) { });
Need to avoid above line of code in AngularJs scripts and projects.
Warning! :)
You never use to implicit dependency injection
in your projects because It can be break your applications and projects.
Thank you very much for reading this post.(Anil
Singh)