What are the advantages of using a function which calls it self to declare a controller in angularjs?
I've seen it in a few projects of angularjs and I was wondering what are the advantages?
for example:
(function () {
'use strict';
angular.module('app')
.controller( 'MainCtrl', ['$scope',
function MainCtrl($scope) {
//...
});
}());
also why did they declare the 'use strict' inside the function? is there any advantage of such things?