Srikanth
Srikanth

Reputation: 37

ng-show is not working in angularjs

my json responce is {isVimeo = true } in angular js

<div ng-show={{isVimeo}}>
    ----
    ----
    ------
</div>

I want to show this div when isVimeo is true,but it is not display at my html.when i click inspect element in my html page the following code is there

<div ng-show="true" class="ng-hide">

</div>

when i remove the ng-hide class in inspect element it is displaying.By default it is not displayong

Can anyone help!

Thanks!

Upvotes: 1

Views: 1185

Answers (2)

ramanathan
ramanathan

Reputation: 104

angular.module('testApp',[]).controller('testCTRL',function($scope)
                               
{
  $scope.wantToShow = true;
  $scope.dontShow = false;
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

<head>ng-show example:</head>
<body data-ng-app="testApp">
    <div data-ng-controller="testCTRL">
      
      <br>
      
      <b>ng-show is true:</b> 
      <span data-ng-show="wantToShow"> It is showing this becuase ng-show is true</span>
      
      <br><br>
      
      <b>ng-show is false(So,nothing we are showing):</b>
      
      <p data-ng-show="dontShow">It is showing this becuase ng-show is true</p>
      
    </div>
</body>

Upvotes: 0

enguerranws
enguerranws

Reputation: 8233

<div ng-show="isVimeo">

And be sure $scope.isVimeo is set to true in the current scope.

Upvotes: 3

Related Questions