【问题标题】:Creating table row angular 1 components with migration to 2 in mind创建表格行角度 1 组件并考虑迁移到 2
【发布时间】:2016-10-09 19:15:39
【问题描述】:

AngularJS nested directives are inserted outside their supposed parent element

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

从 1 迁移到 2 时,这是否会成为问题?
如果是这样,我该如何解决?

【问题讨论】:

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


    【解决方案1】:

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

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

    然后像这样使用它

    <tr myTr></tr>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-15
      • 2011-03-04
      • 1970-01-01
      • 1970-01-01
      • 2016-09-08
      • 1970-01-01
      • 2017-10-15
      相关资源
      最近更新 更多