How to use multiple ng-content in the same component in Angular 2?

后端 未结 1 1151
难免孤独
难免孤独 2020-12-08 04:28

I would like to display different template in my component. Only one will show. If hasURL is true, I want to show the

1条回答
  •  没有蜡笔的小新
    2020-12-08 04:45

    You can wrap ng-content in ng-template and use ngTemplateOutlet

    
        
    
    
    
    
    

    Plunker Example

    See also

    • How to conditionally wrap a div around ng-content

    Angular 9 demo

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