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> 

http://plnkr.co/edit/9wmktr8hpw54k95xqapa?p=preview


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -