创建 table 行 angular 1 组件并考虑迁移到 2
Creating table row angular 1 components with migration to 2 in mind
AngularJS nested directives are inserted outside their supposed parent element
使用 Angular 1.4 我遇到了同样的问题 - 但我也试图将行创建为 Angular 2 个组件,所以我不能使用 "replace: true"。
从 1 迁移到 2 时,这会成为问题吗?
如果是这样,我该如何解决?
您可以改用 class 或属性选择器
@Component({
selector: '[myTr]'
template: `<td></td>`
})
export class MyTr {}
然后像
一样使用它
<tr myTr></tr>
AngularJS nested directives are inserted outside their supposed parent element
使用 Angular 1.4 我遇到了同样的问题 - 但我也试图将行创建为 Angular 2 个组件,所以我不能使用 "replace: true"。
从 1 迁移到 2 时,这会成为问题吗?
如果是这样,我该如何解决?
您可以改用 class 或属性选择器
@Component({
selector: '[myTr]'
template: `<td></td>`
})
export class MyTr {}
然后像
一样使用它<tr myTr></tr>