Angular Ng-show Directive Doesn't Work For Button
I have angular.js web application and btn-group in there like:
Solution 3:
bootstraps' .hidden-xs
class adds display:block
for visible elemets which breaks angular's ng-show
and ng-hide
classes.
Instead, use a custom .my-hidden-xs
class:
// my-style.css@media (max-width: 767px) {
.my-hidden-xs {
display: none !important;
}
}
// index.html
<button class="btn btn-default my-hidden-xs" ng-show="show_button"></button>
Solution 4:
I ran into this issue too. Finally I found that I set the style "visibility: hidden" in my own CSS file to the div. So no matter how I change the expression in ng-show, div is always hidden. That means the visibility style in your own style is always applied, angularjs will never change this css property value. To use ng-show/ng-hide the first thing you need to make sure is that you do NOT add any show/hide style to DOM element, just hand over the control to angular.
Solution 5:
Try replacing ng-show
/ng-hide
with ng-if
.
Should do the trick :)
Post a Comment for "Angular Ng-show Directive Doesn't Work For Button"