Generally `<ng-template>` is used along with structural directives like( *ngIF, *ngFor etc ), like you can write a if condition like this
<div *ngIf="condition; else elseBlock">
True Block
</div>
<ng-template #elseBlock>
<div>
Else block
</div>
</ng-template>
<ng-content> is used for content projection. pls find the below example.
<app-new-component>
<h1>Hey, here is the example code...</h1>
</app-new-component>
Здесь мы размещаем пользовательский код внутри <app-new-component>
, теперь мы можем использовать <ng-content>
для проецирования этого кода внутри app-new-component. html
app-new -компонент. html быть таким
<div class="header-wrap">
<ng-content></ng-content>
</div>