Angular2: replace host element with component's template

前端 未结 5 1707
别跟我提以往
别跟我提以往 2021-01-30 17:23

I\'m new to angular in general and to angular2 specifically. I\'m trying to write a container component, which should have child components in it.

5条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 17:55

    This you should get what you want:

    @Component({
      selector: 'ul[my-list]',
      template: `
        
      `
    })
    export class MyList {
    }
    
    @Component({
      selector: 'li[my-item]',
      template: `
        
      `
    })
    export class MyItem {
    ...
    }
    
    • One
    • Two

提交回复
热议问题