本文介绍了独立的HTML的多个transclusions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想多件transclude成一个指令。这里是我的我怎么会设置它的主意。

I'd like to transclude multiple pieces into one directive. Here is my idea of how I'd set it up.

<div id="content" class="mainDirective">
    <div class="sub">
        <ul>
            <li>Everyone</li>
            <li>Development (3)</li>
            <li>Marketing</li>
        </ul>
    </div>
    <div class="subButtons">
        <span class="csStIcon add" data-ng-click="addTeam()"></span>
        <span class="csStIcon edit" data-ng-click="editTeam()"></span>
        <span class="csStIcon delete" data-ng-click="deleteTeam()"></span>
    </div>
    <div class="main">
        <table>
            <thead>
                <tr><td>Name</td><td>Last name</td><td>Department</td></tr>
            </thead>
            <tbody>
                <tr><td>Lorem</td><td>Ipsum</td><td>Development</td></tr>
                <tr><td>Lorem</td><td>Ipsum</td><td>Development</td></tr>
                <tr><td>Lorem</td><td>Ipsum</td><td>Development</td></tr>
            </tbody>
        </table>
    </div>
</div>

我的指令模板:

<div>
    <div class="left">
        <div data-ng-multi-transclude="sub"></div>
        <div class="bottomOptions">
            <span class="csStIcon collapse"></span>
            <div data-ng-multi-transclude="subButtons"></div>
        </div>
    </div>
    <div class="right">
        <div data-ng-multi-transclude="main"></div>
    </div>
</div>

和最终的输出:

<div>
    <div class="left">
        <div class="sub">
            <ul>
                <li>Everyone</li>
                <li data-ng-click="loadDepartment()">Development (3)</li>
                <li data-ng-click="loadDepartment()">Marketing</li>
            </ul>
        </div>
        <div class="bottomOptions">
            <span class="csStIcon collapse"></span>
            <div class="subButtons">
                <div class="subButtons">
                    <span class="csStIcon add" data-ng-click="addTeam()"></span>
                    <span class="csStIcon edit" data-ng-click="editTeam()"></span>
                    <span class="csStIcon delete" data-ng-click="deleteTeam()"></span>
                </div>              
            </div>
        </div>
    </div>
    <div class="right">
        <div class="main">
            <table>
                <thead>
                    <tr><td>Name</td><td>Last name</td><td>Department</td></tr>
                </thead>
                <tbody>
                    <tr><td>Lorem</td><td>Ipsum</td><td>Development</td></tr>
                    <tr><td>Lorem</td><td>Ipsum</td><td>Development</td></tr>
                    <tr><td>Lorem</td><td>Ipsum</td><td>Development</td></tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

这是可能的范围内的角?

Is this possible within angular?

推荐答案

这已经增加了1.5角

这篇关于独立的HTML的多个transclusions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 13:22