Mitchell Ingram
Mitchell Ingram

Reputation: 706

ng-show/hide is removing everything

I have a dynamically populated tree list that I have shown and hidden. The problem is randomly, the entire list will vanish. Even things that don't have an ng-show are gone. I have tried pretty much everything and it still has the same effect. I am completely stumped.

<div class="legend" ng-show="legend">
<div class="upper_legend">
    <span>Layer Legend</span>
</div>
<div class="lower_legend">
        <div style="padding-left: 8px; min-height:10px" ng-repeat="layer in index.currentLayers track by $index">
            <img src="images/down-arrow.png" style="cursor:pointer" width="10px" height="10px"
                 ng-click="index.currentLayers[$index].show= !index.currentLayers[$index].show"/><span
                    ng-click="index.currentLayers[$index].provenance =!index.currentLayers[$index].provenance;openProvenance(index.currentLayers[$index])"
                    style="cursor:pointer"> {{layer.name}}</span>

            <div class="legend_data" ng-show="index.currentLayers[$index].show">
                <span ng-repeat="color in layer.legendColors">
                    <span style="min-width:50px;height:20px;border-style:solid;border-width:1px;background:{{color.color}}">&nbsp;&nbsp;&nbsp;</span>&nbsp;{{color.legend}}<br>
                </span>
            </div>
        </div>
   </div>
 </div>

Does anyone have any idea why that could possible be happening? It isn't consistent either. It only happens when closing the tree and only on the first item clicked (regardless of index of the item). So, if I open and close the 3rd item, closing it will blank out the tree, but I can then open and close item 1 and it is fine every time, unless I close item 3 again. The same happens with any order.

Upvotes: 1

Views: 34

Answers (1)

Jordan.J.D
Jordan.J.D

Reputation: 8113

You are missing closing </div> tag. Did you double check this (add it to end of this code block)?

enter image description here

Upvotes: 1

Related Questions