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.

2
  • To resolve this issue remove one of the directives which is causing the collision. See AngularJS Error Reference - Error: $compile:multidir. Commented Jun 12, 2018 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. Commented Jun 12, 2018 at 20:10

0

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.