As I delve into the world of AngularJS, I've encountered some intriguing code samples like this one:
(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'));
This snippet demonstrates the creation of a custom directive using an Immediately Invoked Function Expression (IIFE), but what perplexes me is the final line where it's passing a module called common.ui. I'm curious to understand how this method of passing a parameter functions and if there's an alternative approach to achieve the same goal.