ng-content in root Angular 2 component

前端 未结 2 1944
迷失自我
迷失自我 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

提交回复
热议问题