Skip to content

Instantly share code, notes, and snippets.

@ryanve
Created December 12, 2016 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanve/3580908953aae89904e85fac128e45b1 to your computer and use it in GitHub Desktop.
Save ryanve/3580908953aae89904e85fac128e45b1 to your computer and use it in GitHub Desktop.
UMD pattern for Angular directive
!function(root, name, make) {
(root.angular || require('angular')).module(name, []).directive(name, make = make())
typeof module != 'undefined' && module.exports ? module.exports = make : root[name] = make
}(this, 'myDirective', function() {
return function() {
var angular = window.angular || require('angular')
return {
link: function (scope, element, atts) {
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment