ng-show applied display: none
Here's a simple directive that sets the visibility to hidden or visible (but not collapse):
.directive('visible', function() {
return {
restrict: 'A',
link: function(scope, element, attributes) {
scope.$watch(attributes.visible, function(value){
element.css('visibility', value ? 'visible' : 'hidden');
});
}
};
})
Usage:
angular.module('MyModule', [])
.directive('visible', function() {
return {
restrict: 'A',
link: function(scope, element, attributes) {
scope.$watch(attributes.visible, function(value){
element.css('visibility', value ? 'visible' : 'hidden');
});
}
};
})
.controller('MyController', function($scope) {
$scope.showButton = true;
});