0

I am currently receiving a tree of managers and their subordinates from the back end. I'm using a recursive template to display this.

 <script type="text/ng-template" id="managerTmp">

        <div class="accordion">
            {{user.firstName}} {{user.lastName}}
            <ul class="list-group" ng-if="user.subordinates" >
                <li class="list-group-item" ng-if="user.subordinates" ng-repeat="user in user.subordinates" ng-include="'managerTmp'">
                </li>
            </ul>
          </div>
    </script>

    <div class="col-lg-12" ng-show="section === 5">
            <uib-accordion close-others="oneAtATime" ng-show="portal.acManagers && !spinning">
                <ul class="list-group" id="1q2w3e">
                    <li class="list-group-item" ng-repeat="user in portal.acManagers" ng-include="'managerTmp'" ></li>
                </ul>
            </uib-accordion>
   </div>

This all works fine and I get a ul/li of the tree. However, whenever I try changing the ul/li to the angularUI accordion (uib-accordion & uib-accordion-group) i get an error saying

Error: [$compile:multidir] Multiple directives [ngInclude, uibAccordionGroup (module: ui.bootstrap.accordion)] asking for transclusion on: <uib-accordion-group class="list-group-item" ng-if="user.subordinates" ng-repeat="user in user.subordinates" ng-include="'managerTmp'" id="azqx">

I don't fully understand the issue or why angularjs does not allow this? Any help would be greatly appreciated.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
oxygenplug
  • 33
  • 1
  • 6
  • To resolve this issue remove one of the directives which is causing the collision. See [AngularJS Error Reference - Error: $compile:multidir](https://docs.angularjs.org/error/$compile/multidir). – georgeawg Jun 12 '18 at 19:21
  • It would be wise if the `ng-repeat` used another name than `user` for its iterator. The `ng-if` directive is erroneous and not needed. Also it would be helpful if you included the broken code in the example instead of the working code. – georgeawg Jun 12 '18 at 20:10

0 Answers0