Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why doesn't ng-show remove class ng-hide

Tags:

angularjs

I need to show and hide a div. I do it by putting true of false values into the ng-show

<div  class="drawingToolPropertie" ng-show="{{ drawingMods.settingRoof}}">


<div  class="drawingToolPropertie" ng-show="{{ drawingMods.settingObs}}">

But this is what i get:

<div id="roofPropertie" class="drawingToolPropertie ng-hide" ng-hide="true">
<div id="ObstaclePropertie" class="drawingToolPropertie ng-hide" ng-hide="false">

values chage but that ng-hide class stays and as result those divs are always hidden. How do i fix this ? Why is this working like this ? I'm not using jquery.

like image 616
user3074343 Avatar asked Feb 05 '14 13:02

user3074343


People also ask

Can we use ng-show and Ng-hide together?

Absolutely not. First of all, the two directives can trip over each other( see this JSFiddle, as provided by Joel Skrepnek), and is generally just bad design.

What is difference between ng-show and Ng-hide?

The ng-show and ng-hide both are directive . The difference between is : ng-show directive will show the html element if expression resilts is true and ng-hide directive hide the html element if expression result is true .

What is the equivalent of Ng-show and Ng-hide in angular?

You can use [style. display]="'block'" to replace ngShow and [style. display]="'none'" to replace ngHide.

How does ng-hide work?

The ng-hide directive hides the HTML element if the expression evaluates to true. ng-hide is also a predefined CSS class in AngularJS, and sets the element's display to none .


1 Answers

ng-show/ng-hide uses no double brackets

ng-show="drawingMods.settingRoof"
like image 74
doodeec Avatar answered Nov 04 '22 10:11

doodeec