In AngularJS, modules are structured to build highly scalable web applications. We can create them and use them throughout the application.
It is very simple to create and inject it in the application. From the AngularJS documentation, they define modules as:
Tip
Modules are a container for the different parts of your app such as controllers, services, filters, directives, and so on.
More details about modules, can be found at https://docs.angularjs.org/api/ng/type/angular.Module.
Modules can contain a collection of other components/dependencies such as controllers, services, directives, and others.
The basic simple form to create a module is as follows:
angular.module(ModuleName, [requires dependency]);
The basic simple form to use a module is as follows:
angular.module('ModuleName');
Let's see a practical way to declare and instantiate a module and Controller:
angular.module(User, ['$scope']); angular.module('User') .run(function($scope) { $scope.user = { name: 'Fernando'...