I have started learning AngularJS and while going through some code samples I came across the following:
(function(app) {
'use strict';
app.directive('sideBar', sideBar);
function sideBar() {
return {
restrict: 'E',
replace: true,
templateUrl: '/scripts/spa/layout/mypage.html'
}
}
})(angular.module('common.ui'));
The above code creates a custom directive using IIFE. I am very confused about the last line of the code. It is passing a module named common.ui. Can someone explain me how this way of passing a parameter works and how this can be rewritten in a different way?