2

Good day, I'm trying to create tree list from list of items with parent and childs id, that I recursive find with angular material based on following link http://codepen.io/dunmaksim/pen/GJLogo/, but there is something wrong in my code. Child level depends on item.expanded.

 <script type="text/ng-template" id="dirtyDataFromServer.html">
    <md-list-item flex>
        <md-checkbox aria-label="item" ng-model='item.checked' md-indeterminate="isIndeterminate(item, $event)" ng-click="toggleChildrenChekboxes(item, $event)"></md-checkbox>
        <label>{{ item.id }}. {{ item.name }}</label>
        <span flex></span>
        <md-icon style="z-index:100" class="material-icons">
            <i ng-click="toggleItems(item, $event)" class="material-icons">{{item.expanded ? 'expand_less' : 'expand_more' }}</i>
        </md-icon>
    </md-list-item>
    <md-list flex ng-show="item.expanded">
        <div class="list-left-margin" ng-repeat="item in item.subObjs" ng-include="'dirtyDataFromServer.html'"></div>
    </md-list>
</script>

So, whats happens here

1.item 1
2.item 2
      3.item 3
      4.item 4
           6.item 6
           7.item 7
5.item 5

but when I expand, for example item 4:

1.item 1
2.item 2
      3.item 3
      4.item 4
           6.item 6
           7.item 7
      6.item 6
      7.item 7
5.item 5

It create dubble at same level, items are simmilar, but in DOM they are different.

1 Answer 1

1

Problem was in data, problem solved.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.