javascript - ng-show not respecting boolean -



javascript - ng-show not respecting boolean -

so relative newbie angular attempting create nested comments solution every level below first has reply area hidden until click reply on respective comment.

so have driective renders of comments, nests them, etc, hiding of nested reply fields isnt working. should be.

p {{rashowreply}} .wrap(ng-show="rashowreply") p {{rashowreply}}

thats code. outputs

false false

on page. why? fales in first p, apparently true when ng-show evaluated, , false in 2nd p. since same variable , these basic angular bindings, there should no way different should there be?

make sure sharing objects directives, not primitives (such boolean). objects passed reference, booleans aren't.

p {{myobj.rashowreply}} .wrap(ng-show="myobj.rashowreply") p {{myobj.rashowreply}}

then, share myobj object (which has property rashowreply), , when 1 changes, other too.

javascript angularjs angularjs-directive angularjs-scope

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -