AngularJS: ng-show / ng-hide -
i trying show / hide html using ng-show
, ng-hide
functions provided angularjs.
according documentation, respective usage these functions follows:
nghide – {expression} - if expression truthy element shown or hidden respectively. ngshow – {expression} - if expression truthy element shown or hidden respectively.
this works following usecase:
<p ng-hide="true">i'm hidden</p> <p ng-show="true">i'm shown</p>
however, should use parameter object expression ng-hide
, ng-show
given correct true
/false
value values not treated boolean return false
:
source
<p ng-hide="{{foo.bar}}">i shown, or hidden</p> <p ng-show="{{foo.bar}}">i shown, or hidden</p>
result
<p ng-hide="true">i should hidden i'm shown</p> <p ng-show="true">i should shown i'm hidden</p>
this either bug or not doing correctly.
i cannot find relative information on referencing object parameters expressions hoping better understanding of angularjs might able me out?
the foo.bar
reference should not contain braces:
<p ng-hide="foo.bar">i shown, or hidden</p> <p ng-show="foo.bar">i shown, or hidden</p>
angular expressions need within curly-brace bindings, angular directives not.
Comments
Post a Comment