Skip to content

Instantly share code, notes, and snippets.

@snichme
Created December 5, 2013 20:35
Show Gist options
  • Select an option

  • Save snichme/7813394 to your computer and use it in GitHub Desktop.

Select an option

Save snichme/7813394 to your computer and use it in GitHub Desktop.
Requirejs + Angular Injectable modules
// Blank file, will be removed during build
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