using ng-content in ng-template

后端 未结 2 1771
醉话见心
醉话见心 2020-12-30 02:17

Is it possible to use (and its select option) inside a or does it only works within a component ?

2条回答
  •  别那么骄傲
    2020-12-30 02:58

    As far as i know it is not possible using ng-content, but you can provide parameters to the template. So it's possible to pass another NgTemplate, which can again be used with an NgTemplateOutlet inside the original template. Here's a working example:

    
    
    
    
      Hello
    
    
    
    
       World !
    
    

    Actually it is even possible to pass multiple templates to the original template:

    
    
    
    
      Hello
    
    
    
      World
    
    
    
    
      
      
    
    

提交回复
热议问题