angularjs - ng-show not working with ng-include -
http://plnkr.co/edit/0cagxsx847n9lfig4fzj?p=preview
i have 2 files: -index.html (this uses ng-include - doesnt work) -index_embedded.html (uses same code without using include - works)
hi, problem here when hit "click me", hit "close", try hit "click me" again, no longer works.
when use same code without using ng-include, i'm able hit "click me", "close", , "click me" again.
why not working when code in include file?
<h2 ng-click="asdf = !asdf">click me</h2> <!-- <div ng-include="'partials/audiencenav.html'"></div> --> <!-- extracted code include , pasted below, i'm able click, close, , click again --> <div class="" ng-show="asdf"> <div ng-click="asdf = !asdf"><h2>close</h2></div> </div>
the problem when code used placed in include file, breaks after hitting "close".
first time inheriting value of asdf parent until have not clicked on close once have clicked on close creating asdf local scope no more affected clicking on click me, can use $parent.asdf in include file refers parent.
please see updated plunker
<div class="" ng-show="$parent.asdf"> <div ng-click="$parent.asdf = !$parent.asdf"><h2>close</h2></div> </div>
Comments
Post a Comment