Skip to content

Instantly share code, notes, and snippets.

@jamsesso
Created March 27, 2016 16:54
Show Gist options
  • Save jamsesso/dc17ab6d1df7823b6f44 to your computer and use it in GitHub Desktop.
Save jamsesso/dc17ab6d1df7823b6f44 to your computer and use it in GitHub Desktop.
ES6 Directives in Angular - factoryize
import { Inject } from 'decorators';
function factoryize(directive) {
return directive.$inject
? Inject(...directive.$inject)((...dependencies) => new directive(...dependencies))
: () => new directive();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment