允许多个指令在递归模板中转换

时间:2018-06-12 18:38:02

标签: angularjs angularjs-directive angular-ui-bootstrap angularjs-ng-include angularjs-ng-if

我目前正从后端收到一棵经理及其下属的树。我使用递归模板来显示它。

 <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>

这一切都很好,我得到了树的ul / li。但是,每当我尝试将ul / li更改为angularUI手风琴(uib-accordion&amp; uib-accordion-group)时,我都会收到错误

  

错误:[$ compile:multidir]多个指令[ngInclude,uibAccordionGroup(module:ui.bootstrap.accordion)]要求进行翻译:{{1​​}}

我不完全理解这个问题或者为什么angularjs不允许这样做?任何帮助将不胜感激。

0 个答案:

没有答案