I'm running into a roadblock. I have a simple piece of code:
<div ng-app>
<input type="checkbox" ng-model="element" />Hide Element
<div ng-if="!element">
<input type="text" ng-disabled="disable" />
<input type="checkbox" ng-model="disable" />Disable
</div>
</div>
This works fine, but I want the text and second checkbox split into multiple divs, both still dependent on the first checkbox, like:
<div ng-app>
<input type="checkbox" ng-model="element" />Hide Element
<div ng-if="!element">
<input type="text" ng-disabled="disable" />
</div>
<div ng-if="!element">
<input type="checkbox" ng-model="disable" />Disable
</div>
</div>
When I do this, the model does not get applied correctly and I'm unable to disable the text box by using the second checkbox. Am I misunderstanding the scope, or is this a bug?
I know with this example, I could wrap the two in an outer div, but my issue is that my structure is a table structure (yes, it's tabular data), where I don't want to hide an entire row, while keeping my markup as semantic as possible.
<table>
<tr>
<td></td> //this does not get hidden
<td></td> //this does not get hidden
<td></td> //this does not get hidden
<td></td> //THIS GETS HIDDEN
<td></td> //THIS GETS HIDDEN
</tr>
</table>
If you want to play, I set up a basic fiddle: http://jsfiddle.net/qkmv6wfh/