【发布时间】:2015-10-24 10:08:45
【问题描述】:
我正在尝试使用角度指令插入表头。但是,它不是进入所需的thead 内部,而是放置在table 元素之外。
这是代码笔:http://codepen.io/sachingoel0101/pen/yYvmGV
<table class="table table-bordered table-striped">
<thead>
<sortingheader/>
</thead>
<tbody>
</tbody>
</table>
只会变成:
<tr>
<th>Sushi Roll</th>
<th>Fish type</th>
<th>Taste Level</th>
</tr>
<table class="table table-bordered table-striped">
<thead></thead>
<tbody></tbody>
</table>
这是指令代码:
.directive('sortingheader', function() {
return {
replace: true,
template: "<tr><th>Sushi Roll</th><th>Fish type</th><th>Taste Level</th></tr>"
}
})
我做错了什么?
【问题讨论】:
标签: javascript html angularjs