While attempting to create a custom directive for displaying a tree structure, I encountered a strange issue. It appears that including the directive in its own template causes chaos in the angular compiler, leading to the browser process getting stuck in a loop. For reference, here is the code snippet:
<li class="list-group-item">
<a ng-click="clicked(item)"><span ng-if="item.items" class="glyphicon glyphicon-plus text-primary"></span></a>
<span ng-if="!item.items" class="glyphicon glyphicon-record text-primary"></span>
<a>{{item.name}}</a>
<div ng-if="item.items && item.items.length>0">
<ul class="list-group">
<taxonomy-item ng-if="item.items && item.items.length>0" ng-repeat="child in item.items"></taxonomy-item>
</ul>
</div>
This issue is not related to data binding, as it doesn't bind any data, suggesting it's an error with the compiler rather than the model or data...
http://plnkr.co/edit/1aollcuCr2gA96W6Sk6q
Warning: Running this code may cause your browser tab to freeze!
Does anyone have suggestions on how to resolve this problem?