Created
August 2, 2012 18:32
-
-
Save boneskull/3239476 to your computer and use it in GitHub Desktop.
directive to fade in a node
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
// <div fade-in="some_boolean">BOOM</div> | |
myApp.directive('fadeIn', function() { | |
return { | |
restrict: 'A', | |
link: function(scope, element, attribs) { | |
scope.$watch(attribs.fadeIn, function(value) { | |
if (value) { | |
element.fadeIn(); | |
} else { | |
element.hide(); // hide immediately; don't fade out | |
} | |
}); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment