Reputation: 119
Why? html:
<div ng-app="myApp">
<div ng-controller="testCtrl">
<div data-ng-show="{{tags.length > 2}}"><p>{{tags}}</p></div>
<p>{{tags.length > 2}}</p>
</div>
</div>
js:
.controller('testCtrl', function($scope){
$scope.tags = 'Go go go';
});
And shows only 'true'... Why div is hidden?
Upvotes: 0
Views: 36
Reputation: 67296
As @user2422960 says, you just need to remove the {{
and }}
because ng-show
already expects an expression:
<div ng-app="myApp">
<div ng-controller="testCtrl">
<div data-ng-show="tags.length > 2"><p>{{tags}}</p></div>
<p>{{tags.length > 2}}</p>
</div>
</div>
Here is an updated fiddle.
Upvotes: 1