Skip to content

Instantly share code, notes, and snippets.

@morsdyce
Created September 23, 2015 16:21
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 morsdyce/6b0c46422c7f6294c6fd to your computer and use it in GitHub Desktop.
Save morsdyce/6b0c46422c7f6294c6fd to your computer and use it in GitHub Desktop.
If-env angular directive
export function ifEnv(ENV) {
return {
restrict: 'A',
priority: 600,
transclude: 'element',
terminal: true,
link: function(scope, element, attrs, ctrl, $transclude) {
if (ENV === attrs.ifEnv) {
$transclude(function (clone) {
element.after(clone);
});
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment