I'm adding virtual slides to my swiper with swiper.js. The array that contains the slides, according to the examples, use strings like below (docs say slides: any, but I tried a component and other things, but nothing else worked):
virtual: {
// cache: true,
slides: (function() {
const slides = [];
for (let i = 0; i < 1; i += 1) {
slides.push('<img src="https://picsum.photos/600/600/?image=1/>';
}
return slides;
})()
},
Problem - I want to use a custom component 'app-member-card' as my slide instead of a string, so I add it as a string like below, but when it's rendered on the screen it doesn't interpolate/transpile/compile/render/etc the components code or HTML, the debugger shows the string I passed it.
I'd like to do this:
slides.push('<app-member-card class="router-link" [MemberCard]="member"></app-member-card>');
Where this below is what I'd see on the screen:
<div class="card member-card">
<div class="row">...other tags left out here for verbosity</div>
</div>
Question: Is there something I can do in Angular or swiper.js that will translate this string into the component when adding it as a slide? I couldn't find anything in the swiper doc and not that familiar with all of the Angular stuff.
What I tried - I tried dynamically creating the component in my .ts file and adding the properties, but when I try and extract the innerHTML as a string from the viewContainerRef all data is empty. Here is my link to that post on SO