Carousel is used to show images in a slideshow. This template is responsive so it will display gorgeously on all screen types including mobiles and computers. In addition, our carousel will automatically change its size to fit the image’s size.
Carousels are often used to display a series of looping images. There are some other popular usages of carousel. Some of them are:
- Teasers
- Articles
- Entire sections of web pages
-
Download the carousel template from Neutrinos store.
-
Install the template into N-Studio.
-
When creating a new app, select the carousel template from the ENTER APP DETAILS menu and click on the create button.
-
Create a component (Example:carousel)
-
In TS file
-
Import services: one service based on user requirements (Example: imageservice) and another, carousel service, which contains observable media- used for tracking the responsiveness.
import{imageserviceService}from'../../services/imageservice/imageservice.service';
import { carouselserviceService } from '../../services/carouselservice/carouselservice.service';
-
Inject the two services in 'constructor'
constructor(private imgService:imageserviceService,private cService:carouselserviceService) { }
-
Inside class, declare the variables used
imagedata : String ; limit : any ;
-
In ngOnInit
this.imageData = this.imgService.getImages();
imagedata - Variable used in imageservice. imgservice - Keyword for the service.
-
write a function
ngDoCheck() { this.limit = this.cService.assignLimit(1, 2, 4); }
limit - Variable used in carouselservice. cservice - Keyword for the service. ngDoCheck() - Function used for tracking the responsiveness.
-
In HTML file
Drag and drop a custom html to call the child component
<bh-carousel [imageData]="imageData"[limitImage]="limit" *ngIf="imageData"></bh-carousel>
carousel- Name of the child component.
- Devices: Android, iOS
- Browsers: Latest version of all modern browsers
- Dependencies version :
- Angular CLI version: 6.0.0 +
- Cordova version: 7.1.0 +