Remove host component tag from html in angular 4

后端 未结 1 2017
孤街浪徒
孤街浪徒 2020-11-29 09:37

I have a table in which I want to display a table row, which is a component. And also I want to pass data to that component:

相关标签:
1条回答
  • 2020-11-29 09:40

    you need to include tr as well in selector like below,

    @Component({
     selector: 'tr[my-component]',
     template: `
       <td>{{data1.prop1}}</td>
       <td>{{data1.prop2}}</td>
       <td>{{data2.prop1}}</td>
     `
    })
    export class MyComponent {
      @Input() data1;
      @Input() data2;
    }
    

    Check this Plunker!!

    0 讨论(0)
提交回复
热议问题