As a beginner in Angular, I've been working on creating a carousel component that can be shared. The structure of this component is based on the latest version of Bootstrap and I am looking to allow templates to be injected by the caller.
For instance, here is an example of how the carouselComponent's DOM might look:
<div class="carousel">
<div class="carousel-indicators">
<!-- Template passed by the caller
<div data-index="0"></div>
-->
</div>
<div class="carousel-inner">
<!-- Template passed by the caller
<div class="carousel-item" data-index="0"></div>
-->
</div>
</div>
My initial thought process looked something like this:
<carousel>
<template-list>
<div dataIndex="0">Ciao Mondo!</div>
<div dataIndex="1">Hello World!</div>
<div dataIndex="2">Hola Mundo!</div>
</template-list>
</carousel>
In this scenario, all carousel indicators are calculated based on the template list provided, and the carousel inner section is populated with the templates from the list wrapped in div.carousel-item elements.
Unfortunately, I haven't found a solution to this problem yet. My goal is to separate the component from its logic so it can be easily reused in different scenarios.
Thank you to everyone for your assistance! :)