mujtaba01 / ngx-owl-carousel

An angular2 (4) wrapper for jquery owl-carousel library with dynamic carousel item change detection
MIT License
70 stars 25 forks source link

Move nav divs out of component #8

Closed abelkbil closed 7 years ago

abelkbil commented 7 years ago

How can I move previous and next div out of component section. Please enable wiki, so that we can update these answers there. Thanks.

mujtaba01 commented 7 years ago

To hide default previous and next buttons you need to pass {navigation: false} in options input. Create next and previous buttons manually outside the component and call component's previous and next function on click events. Like this:


<button (click)="owl.previous()">Previous</button>

<owl-carousel [items]="images" #owl [options]="{ navigation: false}" [carouselClasses]="carouselClasses">
    <div *ngFor="let image of images">
        <div [ngStyle]="{'background-image': 'url(' + image.url  + ')'}"></div>
    </div>
</owl-carousel>

<button (click)="owl.next()">Next</button>
abelkbil commented 7 years ago

@mujtaba01 Thanks a lot.