Angular 2 passing html to ng-content with bindings

前端 未结 3 864
悲哀的现实
悲哀的现实 2020-12-08 10:41

I\'m writing angular components for the foundation css framework. I am working on the tabs component, and want to be able to pass some HTML to the

3条回答
  •  伪装坚强ぢ
    2020-12-08 11:08

    You should be using this way instead,

    
        
    Age
    {{item.age}}
    `

    Component typescript

    @Component({
      selector: 'tabs',
      templateUrl: './tabs.component.html'
    })
    
    export class TabsComponent {
      @Input() data:any;
      item:any{};
    }
    

    In your content projection define a selector as

     

    As your passing with bindings

    
        
    Age
    {{item.age}}
    `

    DEMO

提交回复
热议问题