#最佳实践与填坑的积累
写一个remove-host
指令
1 | //remove the host of avatar to be rendered as svg |
使用方式:<avatar [name]="hero.name" remove-host></avatar>
<ng-content>
为空Wrap ng-content
in an HTML element like a div
to get a local reference to it, then bind the ngIf
expression to ref.childNodes.length == 0
:
1 | template: `<div #ref><ng-content></ng-content></div> |