New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ng2-custom-carousel

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-custom-carousel

Carousel Component for Angular 2+. Easily customizable, with autoscroll, loop and navigation controls

latest
Source
npmnpm
Version
0.0.30
Version published
Maintainers
1
Created
Source

Ng2CustomCarousel

Carousel component for Angular 2+. Easily customizable, with autoscroll, loop and navigation controls. List of features

  • Easily customizable.
  • Autoscroll.
  • Continuous loop.
  • Navigation indicators and controls.
  • Customizable number of visible slides.
  • Customizable direction of scroll.
  • Customizable speed of scroll.
  • Slides margins.

Examples/Demo

  • Live Demo: https://www.ritxweb.com/ng2carousel/

Installation

npm i ng2-custom-carousel

API

import { Ng2CustomCarouselModule } from 'ng2-custom-carousel';
selector: ng2-custom-carousel

@Inputs()

InputTypeRequiredDescription
timingstringOptional, default: '250ms ease-in'the time and type of transition between slides.
showControlsbooleanOptional, default: trueif true shows the 'next' and 'prev' navigation controls.
showNavigationstringOptional, default: 'radio'choose the type of navigation indicators between 'radio', 'numbers' or 'none'
autoScrollnumberOptional, default: 0number of milliseconds between navigation of slides automatically, 0 for no auto navigation.
loopbooleanOptional, default: trueif true the carousel runs in continuous loop.
slidesNnumberOptional, default: 0max number of slides to show, 0 to show all the slides possible.
scrollDirectionstringOptional, default: 'left'choose the direction of the autoscroll between 'left' or 'right'.
slidesMarginnumberOptional, default: 0number of pixels of margin between slides.

Usage

  • Register the Ng2CustomCarouselModule in your app module.

import { Ng2CustomCarouselModule } from 'ng2-custom-carousel';'

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { AppComponent } from './app.component';
import { Ng2CustomCarouselModule } from 'ng2-custom-carousel';

@NgModule({
 declarations: [
   AppComponent
 ],
 imports: [
   BrowserModule,
   BrowserAnimationsModule,
   Ng2CustomCarouselModule
 ],
 providers: [],
 bootstrap: [AppComponent]
})
export class AppModule { }

  • Use the selector (ng2-custom-carousel) in your component.
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `
    <div class="ng2-custom-carousel-container">
      <ng2-custom-carousel timing="400ms ease-in" [showControls]="true" [autoScroll]="2000" showNavigation="radio"
        [slidesN]="4" [loop]="true" scrollDirection="left" [slidesMargin]="100">
        <ng-container *ngFor="let item of ng2CusomCarouselItems;">
          <ng-container *ng2CustomCarouselItem>
            <div class="ng2-custom-carousel-element">
              <!-- PLACE HERE YOUR SLIDE CONTENT -->
              {{item.title}}
            </div>
          </ng-container>
        </ng-container>
      </ng2-custom-carousel>
    </div>
  `,
  styles:[`
    .ng2-custom-carousel-container {
      width: 100%;
      margin: auto;
    }

    .ng2-custom-carousel-element {
      padding: 0;
      width: 300px;
      height: 300px;
      background-color: crimson;
      color: #fff;
      font-size: 50px;
      line-height: 300px;
      text-align: center;
    }
  `]
})
export class AppComponent {
  ng2CustomCarouselItems = [
    { title: 'Slide 1' },
    { title: 'Slide 2' },
    { title: 'Slide 3' },
    { title: 'Slide 4' },
    { title: 'Slide 5' },
    { title: 'Slide 6' },
    { title: 'Slide 7' },
    { title: 'Slide 8' },
    { title: 'Slide 9' },
    { title: 'Slide 10' },
    { title: 'Slide 11' }
  ];
}

Running the example in local env

  • npm i
  • ng build ng2-custom-carousel
  • Run ng serve for a dev server and running the demo app. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Build the Ng2CustomCarousel module

Run ng build ng2-custom-carousel to build the module. The build artifacts will be stored in the dist/ng2-custom-carousel directory.

Running unit tests

Run ng test ng2-custom-carousel to execute the unit tests via Karma.

License

This project is licensed under the GNU General Public License v3.0.

Credits

To my families.

Keywords

angular

FAQs

Package last updated on 21 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts