Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
app.directive('myOverlayer', function(ElementRegistry){
return {
link: function(scope, element, attrs){
var content, background,
registry = new ElementRegistry(scope);
registry.find('button', function(button){
button.on('click', function(){
scope.overlayShowing = !scope.overlayShowing;
registry.find('content', function(elem){
content = elem;
registry.find('background', function(elem){
background = elem;
scope.$watch('overlayShowing', function(showing){
var display = showing ? 'block' : 'none';
if(content) { content.css('display', display) }
if(background) { background.css('display', display) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment