如何在模板指令中添加模板?

时间:2016-07-25 11:31:19

标签: angularjs

我有3个不同模板的指令,但是在每个模板中我都有一个每次都几乎相同的表,它只是有不同的数组。我怎样才能让那个表处于链接或类似的东西,只给她什么数组呢?

例如,我在指令模板和没有复选框的表中有。在每个模板中我都有不同的东西,比如这里我有其他的复选框我有按钮和。

<table ng-show="myprops.List.length>0" class="table" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <th>Start Date</th>
                        <th>End Date</th>
                        <th>Hours</th>
                        <th><input type="checkbox" ng-click="toggleAll()" ng-model = "isAllSelected" ></th>
                    </tr>
                    <tr ng-repeat="node in myprops.List">
                        <th>{{node.startDate | date: 'yyyy-MM-dd'}}</th>
                        <th>{{node.endDate | date: 'yyyy-MM-dd'}}</th>
                        <th>{{node.workInHours }}</th>
                        <th><input type="checkbox" ng-click="onClick()" ng-model="node.selected" ></th>
                    </tr>
                </table>
                <button ng-show="myprops.List.length>0"  type="button" class="btn btn-danger" ng-click="deleteItems()">Remove</button>

只有具有相同道具的不同数组才相同。

<tr>
                            <th>Start Date</th>
                            <th>End Date</th>
                            <th>Hours</th>
...
 </tr>
                        <tr ng-repeat="node in myprops.List">
                            <th>{{node.startDate | date: 'yyyy-MM-dd'}}</th>
                            <th>{{node.endDate | date: 'yyyy-MM-dd'}}</th>
                            <th>{{node.workInHours }}</th>

0 个答案:

没有答案
相关问题