Angular Content projection

yotube
0

 Link : https://angular.io/guide/content-projection


Content projection user to create flexible, reusable components.





Example 

<h2>Multi-slot content projection</h2> Default: <ng-content></ng-content> Question: <ng-content select="[question]"></ng-content>



<app-zippy-multislot> <p question> Is content projection cool? </p> <p>Let's learn about content projection!</p></app-zippy-multislot>





--


<ng-container left-panel [ngTemplateOutlet]="leftPanel"> </ng-container>

<ng-template #leftPanel>
code
</ng-template>

<div *ngIf="expanded" [id]="contentId"> <ng-container [ngTemplateOutlet]="content.templateRef"></ng-container></div>


<ng-template appExampleZippyContent> It depends on what you do with it. </ng-template>


The <ng-template> element defines a block of content that a component can render based on its own logic. 

Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top