Today I am going to create a demo of owl carousel with angular 6. This is one of the very common topics while working on web application development.
If you have not installed Angular latest version in your system then read getting started with angular.
Now let's proceed to create the demo.
Create a new angular app by typing below command over terminal
ng new owl-carousel
Now after the successfull app creation, Move to the project folder with cd owl-carousel/ and install required npm packages.
npm install ngx-owl-carousel owl.carousel jquery --save
In the above command we have installed 3 npm packages, ngx-owl-carousel is used for rich carousel feature of jQuery to get integrated with Angular. Owl.carousel is the main package where the actual task performs. jQuery is needed for main Owl carousel to work.
In angular.json at root of the project, add library script and styles like below:
import { OwlModule } from 'ngx-owl-carousel';
// Add OwlModule to imports at below section
imports: [
BrowserModule,
OwlModule
],
In the above code we have generated a static array of images we will have in owl-carousel. Also we have updated here the default setting of the slider.
In this demo, we used the npm packages for owl-carousel. Find the official documentation here.
That’s all for now. Thank you for reading and I hope this post will be very helpful for integrating owl carousel in angular app.
Let me know your thoughts over the email demo.jsonworld@gmail.com. I would love to hear them and If you like this article, share with your friends.
Find complete source code over GitHub