创建表行角度1组件时考虑到迁移到2

时间:2016-06-09 08:36:06

标签: angularjs angularjs-directive angular migration angularjs-components

  

AngularJS nested directives are inserted outside their supposed parent element

使用Angular 1.4我遇到了同样的问题 - 但我也试图将行创建为Angular 2组件,所以我不能使用" replace:true"。

从1迁移到2时,这会是一个问题吗? 如果是这样,我该如何解决?

1 个答案:

答案 0 :(得分:0)

您可以使用类或属性选择器

@Component({
  selector: '[myTr]'
  template: `<td></td>`
})
export class MyTr {}

然后像

一样使用它
<tr myTr></tr>