Created
December 5, 2013 20:35
-
-
Save snichme/7813394 to your computer and use it in GitHub Desktop.
Requirejs + Angular
Injectable modules
This file contains hidden or 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
| // Blank file, will be removed during build |
This file contains hidden or 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
| require.config({ | |
| paths: { | |
| "angular": "angular/angular", | |
| "foo": "foo" | |
| }, | |
| shim: { | |
| 'angular': { | |
| exports: 'angular' | |
| }, | |
| 'foo': { | |
| deps: ['angular'], | |
| init: function (angular) { | |
| var module = angular.module("foo", []); | |
| angular.bootstrap(document, ['foo']); | |
| //delete this.angular; // Might not work with other modules if removed. | |
| return module; | |
| } | |
| } | |
| } | |
| }); | |
| require(['main', 'angular', 'foo'], function() { | |
| console.log(arguments); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment