What Is The Benefit Of Wrapping Angular Controller/service/factory Declarations In An Anonymous Function
I've seen a few developers tout 'best practices' when wrapping angular components in anonymous functions. For example: (function(){ angular.controller('MyCtrl', [function(){
Solution 1:
This is an immediately invoked function.
(function(){
})()
The above will declare an anonymous function that will be called immediately.
Post a Comment for "What Is The Benefit Of Wrapping Angular Controller/service/factory Declarations In An Anonymous Function"