aliencity
aliencity

Reputation: 83

ng-show/ng-hide not working on passing the boolean variable

Hi I am trying to change the glyphicon icon from glyphicon-remove to glyphicon-ok once the file upload completes by passing single boolean value so that I have toggle effect. The initial value passed to the variable status is false so glyphicon-remove shows and glyphicon-ok hides. Once the file upload completes I set the value of status variable (as shown below) to true so that the two icons get toggled

<div ng-show='{{status}}' class="glyphicon glyphicon-ok"></div>
<div ng-hide='{{status}}' class="glyphicon glyphicon-remove"></div>

On file-complete event I do this

$scope.status = true;

But for some reason it's not working the 'remove' icon stays shown and 'ok' icon stays hidden even though the status is changed to true. The truth values are passing fine I've checked. Any idea what could be wrong??

Upvotes: 1

Views: 461

Answers (1)

Marcin Strzyż
Marcin Strzyż

Reputation: 61

You don't need the curly braces in a attribute while using a directive

<div ng-show='status' class="glyphicon glyphicon-ok"></div>
<div ng-hide='status' class="glyphicon glyphicon-remove"></div>

Upvotes: 4

Related Questions