Skip to content

Instantly share code, notes, and snippets.

@c0bra
Created June 25, 2013 15:15
Show Gist options
  • Save c0bra/5859295 to your computer and use it in GitHub Desktop.
Save c0bra/5859295 to your computer and use it in GitHub Desktop.
ngVisible angular directive
.directive('ngVisible', function () {
return function (scope, element, attr) {
scope.$watch(attr.ngVisible, function (visible) {
element.css('visibility', visible ? 'visible' : 'hidden');
});
};
})
@jfbrennan
Copy link

For those who want to toggle a class (FYI "invisible" is the correct Bootstrap class name, you're welcome:)):

element[visible ? 'removeClass' : 'addClass']('invisible');

@ahmedam55
Copy link

Thanks for your time and efforts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment