gpt4 book ai didi

angularjs - 表内的指令呈现在表外

转载 作者:行者123 更新时间:2023-12-02 04:31:36 26 4
gpt4 key购买 nike

我有一个具有隔离范围的指令,如下所示:

.directive('hello', function() {

return {
restrict: 'E',
replace: true,
template: '<h1>Hello Directive</h1>',
scope: {}
};

});

如果我将该指令放入表中,奇怪的是,即使用作属性,该指令也会呈现在表外:

<table>    
<tr>
<hello></hello>

<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
</tr>
</table>

enter image description here

有什么解决办法吗?

我创建了一个 Codepen 来演示这一点:http://codepen.io/jviotti/pen/AtnzJ/ .

编辑:我尝试将 h1 包装在 td 中。它仍然呈现在表格之外:

enter image description here

最佳答案

缺少 <td>标签包裹元素, <h1>不能直接作为 <tr> 的子项插入.

关于angularjs - 表内的指令呈现在表外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22972403/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com