ng-content in root Angular 2 component

前端 未结 2 1943
迷失自我
迷失自我 2021-01-18 06:43

The page shows basic markup, comforting message and loading indicator.


...

...page layout and loading stuff...


&         


        
相关标签:
2条回答
  • 2021-01-18 07:17

    The link below has been given the status fixed by ivy. Ivy is a milestone for angular v7.0.


    Transcludes are not supported on the root element, you can't pass anything to it because index.html isn't part of angular. If you can't embed the html within another component then I wouldn't expect it to work with ng-content either.

    From https://github.com/angular/angular/issues/1858#issuecomment-207993202

    Components only work as components when referenced in the template of another component, yet they are expected to be used outside of this which causes confusion

    0 讨论(0)
  • 2021-01-18 07:33

    Using <ng-content> in root component planned to be implemented.

    https://github.com/angular/angular/issues/4946

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