Answer the question
In order to leave comments, you need to log in
Why is ngTemplateOutlet not working?
Hello. I'm studying the projection of content and ran into a problem, the attribute is not perceived. I searched where it can be imported from, googled what could be the problem, but I have no idea, BrowserModule is connected, you can't import it from @angular/common.
app.component.html
<app-header>
<div *ngIf="true" [id]="1">
<ng-container [ngTemplateOutlet]="content.templateRef"></ng-container>
</div>
</app-header>
<header>
<ng-template appExampleZippyContent>
It depends on what you do with it.
</ng-template>
<!-- <app-logo [_name]="name" (name)="setName($event)"></app-logo>-->
</header>
import {Directive, TemplateRef} from "@angular/core";
@Directive({
selector: '[appExampleZippyContent]'
})
export class ZippyContentDirective {
constructor(public templateRef: TemplateRef<unknown>) {}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question