In my AngularJS app, I created a recursive template.
For illustration, it works something like this:
<div ng-repeat="item in stuff">
<div ng-include="'myTemplate.html'" onload="item = item"></div>
</div>
<script type="text/ng-template" id="myTemplate.html">
<h1> {{levelsDeep | "root"}} </h1>
<h2> {{item.content}} </h2>
<div ng-include="'myTemplate.html'" onload="item in item.innerItem; levelsDeep = levelsDeep+'->'"></div>
</script>
In this recursive template, I want the top level line to read "root" and the inner levels to read '->->->' etc, depending on how deeply nested they are.
Is there a filter to check if levelsDeep has not yet been defined (like in the first step) and then print "root" if this is so?