I'm encountering a strange issue that I can't seem to understand.
My goal is to have a block appear on a page based on an ng-if
condition. However, when I try to modify this ng-if
within the block, it doesn't impact other elements as expected.
What could be causing this behavior?
You can find the JSFiddle here with the code provided below:
<div ng-controller="MyCtrl">
<div ng-init="shouldShow=false">
<div ng-if="!shouldShow">
<p>{{shouldShow}}</p>
<div>
<button ng-click="shouldShow=!shouldShow">Hide Section</button>
<button ng-if="!shouldShow">Should Disappear</button>
</div>
</div>
</div>
</div>