A module in AngularJS wires together some of the following components:
Creating a custom module is as simple as using angular.module API thereby passing the name and module dependencies and, defining one or more components. Take a look at following:
angular.module( "ModuleName", [] )
.factory( "ServiceName", [ 'depName', function( depName){
// code goes here...
}])
.filter( "filterName", [ 'depName', function(depName)]{
// code goes here...
})
.directive( "directiveName", [ 'depName', function( depName ){
// code goes here...
}])
At lower level, a module is primarily a collection of two kind of blocks that are following:
angular.module('ModuleName', []).
config(function($provide, $compileProvider, $filterProvider) {
$provide.factory('ServiceName', [ 'depName', function( depName){
// code goes here...
}]);
$filterProvider.register('filterName', [ 'depName', function(depName)]{
// code goes here...
}]);
$compileProvider.directive('directiveName', [ 'depName', function( depName ){
// code goes here...
}])
});
[adsenseyu1]
Last updated: 3rd May, 2024 Have you ever wondered why some machine learning models perform…
Last updated: 2nd May, 2024 The success of machine learning models often depends on the…
When working on a machine learning project, one of the key challenges faced by data…
Last updated: 1st May, 2024 The bias-variance trade-off is a fundamental concept in machine learning…
Last updated: 1st May, 2024 As a data scientist, understanding the nuances of various cost…
Last updated: 1st May, 2024 In this post, you will learn the concepts related to…