Search code examples
angularjsangularjs-directiveangularmigrationangularjs-components

Creating table row angular 1 components with migration to 2 in mind


AngularJS nested directives are inserted outside their supposed parent element

Using Angular 1.4 I hit the same same problem - but I'm also trying to create the rows as Angular 2 components, so I can not use "replace: true".

Will this be a problem at all when migrating from 1 to 2?
And if so, how can I solve it?


Solution

  • You can use a class or attribute selector instead

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

    and then use it like

    <tr myTr></tr>