Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng-show disturbing div layout - angularJS

Tags:

I am using ng-show="!notesOpened" to hide a div if the notesOpened variable is true. However when hidden it messes up layout. Is there a way to make ng-show act in the same way as the css property visibility:hidden? so that all div elements around the div being hidden stay in the same place

like image 317
FootsieNG Avatar asked Apr 14 '14 13:04

FootsieNG


2 Answers

ng-hide uses the same property that you're referring to, i.e. display: none.

If you need to achieve this, you need to use visibility: hidden;

For that you can use the ng-class attribute.

eg: ng-class="{'vis-hidden': notesOpened==true}"

  .vis-hidden{      visibility: hidden;   } 
like image 91
Pooja Shah Avatar answered Oct 19 '22 22:10

Pooja Shah


I have got this working

ng-style="{visibility: notesOpened && 'visible' || 'hidden'}"

like image 38
Himanth Kumar Avatar answered Oct 19 '22 23:10

Himanth Kumar