AngularJs Minification Problems and Solutions

AngularJs Minification Problems and Solutions


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.

var app = angular.module('minifyApp', []);

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)


ANIL SINGH

Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - http://www.code-sample.com and http://www.code-sample.xyz
My Books - Google Amazon and Flipkart Book Store!

You Might Also Like
Post a Comment
www.code-sample.com/. Powered by Blogger.
ASK Questions
SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book