Created
July 12, 2015 23:44
-
-
Save leog/6fabdf15190f4ae24533 to your computer and use it in GitHub Desktop.
Very simple RequireJS modules defining AngularJS modules exporting their own module name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['angular'], function(angular) { | |
var settings = { moduleName: 'first' }; | |
angular | |
.module(settings.moduleName, []) | |
.filter('greet', function() { | |
return function(name) { | |
return 'Hello, ' + name + '!'; | |
} | |
}); | |
return settings; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['angular', 'firstModule'], function(angular, first) { | |
angular | |
.module('second', [dependency.moduleName]) | |
.filter('goodbye', function() { | |
return function(name) { | |
return 'Good bye, ' + name + '!'; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If think there is a mistake on line 3 in secondModule.
It should be
[first.moduleName]
rather than[dependency.moduleName]
.