Hi there!
In an Ionic project we are wrapping code from each js file in an anonymous closure like this:
(function () {
'use strict';
angular
.module('demo')
.controller('HomeController', HomeController);
/* @ngInject */
function HomeController(ENV) {
var vm = this;
// vm variables
vm.environment = ENV.name;
// vm functions
vm.createGroup = createGroup;
vm.openMyProfileModal = openMyProfileModal;
_activate();
/////////////////
function _activate() {
}
function createGroup() {
}
function openMyProfileModal() {
}
}
})();
I’d like to ask if this is being seen by the community as good practice.