Created
December 12, 2016 18:54
-
-
Save ryanve/3580908953aae89904e85fac128e45b1 to your computer and use it in GitHub Desktop.
UMD pattern for Angular directive
This file contains 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
!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