Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Annotations in ES5
// helper function, we can even ship these
define(['di/annotations'], function(annotations) {
var Inject = annotations.Inject;
var annotate = annotations.annotate;
return function inject(fn) {
var deps =, 1);
var annotation = new Inject();
Inject.apply(annotation, deps);
annotate(fn, annotation);
define(['./inject-helper', 'foo'], function(inject, Foo) {
inject(MyController, Foo);
function MyController(foo) {
// ...
return MyController;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment