I'm attempting to create a little swipe-able slider that uses just angular and hammerjs. The slides would go in a basic order like [1, 2, 3]
etc. but in order to create loop
functionality it would need to be something like [clone 3, 1, 2, 3, clone 1]
.
I have a slider as a component <hammer-slider>
and each slide is also a component <hslide>
. I then use on the container comp and I collect the QueryList of all the hslide
components, this is where I just assumed that I would be able to clone the instances of <hslide>
and pop them on either of slide content or wrap
in my example.
Example is here - https://stackblitz.com/edit/angular-hammer-slider?file=app%2Fhammer-slider%2Fhammer-slider.component.ts
// This gets me the slides;
@ContentChildren(HSlideComponent) hslides: QueryList<HSlideComponent>
// You can see my attempts
ngAfterViewInit(){
console.log(this.hslides);
Most of my attempts using methods like createEmbeddedView
seem to move and not copy the Element and also don't keep the style.
I don't know if I'm just missing something simple or if this is even possible or I may just totally be doing all wrong.
Not looking for a referral to npm install some-other-slider