(function(ng, app){
app = angular.module('app', []);
app.config(function($provide) {
$provide.constant('town', 'Burlington');
});
app.constant('name', 'Rob F.');
app.controller('MainCtrl', [
'name', 'town',
function MainCtrl(name, town) {
this.getName = function() {
return name;
};
this.getTown = function() {
return town;
};
}
]);
}(angular));
http://jsfiddle.net/founddrama/RvXn3/
Upon reviewing the code, I noticed that angular
is being passed as an argument, but the immediately invoked function expression (IIFE) collects ng, app
. I am curious about the roles of ng, app
in this context. How are they utilized within the code?