ngTemplateOutlet: The secret to customisation #37
Replies: 4 comments 3 replies
-
Nice project but I have a small issue with it. You use an element id to identify the options template (#optionName) rather than using a directive. By using a directive you eliminate the possibility of miss-spelling the template identifier (which would break the app if the developer does that). |
Beta Was this translation helpful? Give feedback.
-
Great article !! but I'm just curious when you said "You can also use @ContentChild to pass the template into your component. This forces the template to be defined within the " but still you defined the sharkTemplate outside the app-selector and in |
Beta Was this translation helpful? Give feedback.
-
Great Article. I have small doubt, we you used local reference(#optionTemplate) to reference the template(while passing it as input component or getting it via ContentChildern)some libraries like ngPrime they do not use local reference. I am wondering how they refer to template for ex - <p-dropdown [options]="countries" [(ngModel)]="selectedCountry" > {{selectedCountry.name}}
here no template reference is placed just this pTemplate thing |
Beta Was this translation helpful? Give feedback.
-
Hi, how to handle such situation? Below is a part of my page markup. And the problem is
|
Beta Was this translation helpful? Give feedback.
-
ngTemplateOutlet is a powerful tool for creating customisable components. It is used by many Angular libraries to enable users to provide custom templates. But how can we do this for our own components?
In this article we demonstrate how to use ngTemplateOutlet, along with ngTemplateOutletContext, to make a component completely customisable.
Beta Was this translation helpful? Give feedback.
All reactions