Angular 2 image slider with example and demo

Angular 2 image slider with example and demo

In this post we will show you Angular 2 image slider with example and demo , hear for Angular 2 image slider with example and demo we will give you demo and example for implement.

Hear is Git hub like for Download, Demo and for information(Read More), it will help you into development and implement for Angular 2 image slider with example and demo . This link of git will give you document, instruction, installation and other information.

Read More Demo Download

I utilize System.js which deals with transpiling Typescript to Javascript (ES5), which is arranged in the index.html document (in venture root) :

<!-- Angular 2 image slider -->

System.config({packages: {app: {format: 'register',defaultExtension: 'js'}}});

System.import('app/app').then(null, console.error.bind(console));





Components for Angular 2 picture slider

I have to make an application part (which has a selector application ), which renders a view. The view (format) will have a tyke segment SlideShow (which has a selector slide-appear). So as to utilize the selector slide-demonstrate I have to import the segment and pass it as mandate into the application part. At long last I will bootstrap the application :

// Angular 2 image slider
import {bootstrap} from 'angular2/stage/program';

import {Component, View} from 'angular2/center';

import {SlideShow} from './slide-appear/slide-appear'


selector: "application"



orders: [SlideShow],

format: `




class App{


console.log('initialised app!');



bootstrap(App, []);

The application segment will render :

The Slide-Show segment will have 3 kid parts for Angular 2 picture slider

  • slide-demonstrate control
  • slide-demonstrate pictures
  • slide-demonstrate sneak peaks

which should be transported in and gone into the slide-indicate part as mandates.

The slide-indicate part will stack a format which resembles this :

<!-- Angular 2 image slider -->
<slide-demonstrate control class="control" (changed)="setCurrent($event)" [maximum]="pics.length" [current]="current"></slide-indicate control>

<slide-indicate pictures [pics]="pics" [current]="current"></slide-demonstrate images>

<slide-indicate sneak peaks (changed)="setCurrent($event)" [pics]="pics" [current]="current"></slide-demonstrate previews>

I make the accompanying ties for Angular 2 picture slider

  • most extreme: holds the (greatest) number of pictures accessible
  • current : holds the number if the as of now chose picture
  • pics : holds the URLs to the pictures

A general data about ties :

While property ties are utilized to pass information from a parent to a kid parts, occasion ties are utilized to pass information from a youngster to a parent segment.

As I need to really have the capacity to change current in the kid segments slide-indicate control and slide-demonstrate see I have to utilize an EventHandler (named changed) :


In the event that the occasion changed is let go, the strategy setCurrent (of the parent segment) will be called.

In the kid segments I will have the accompanying comments :

@Input (information bound info property) – > square brakets [] , i.e. [current]

@Output (an occasion bound yield property) – > enclosure (), i.e. (changed)

As I need to change the estimation of current in the slide-demonstrate review I would tap on an alternate thumbnail. I tune in for a tick occasion, which will call the technique resetCurrent.

// Angular 2 image slider
@Output() changed = new EventEmitter();

constructor (){



resetCurrent (_ind) {

this.current = parseInt(_ind+1);

this.changed.emit(this.current);//discharges the occasion


which will discharge the occasion and pass the new esteem. The setCurrent technique allot the new esteem (to current) and the new estimation of current will be spread to the tyke parts.

// Angular 2 image slider

this.current = _newValue;



See this Url
AngularJS ForEach Function with example
Angular 4 Flexible Table Component with example
Angular 2 Flexible Table Component with example
Angular 2 Chilled Loading Buttons with example
Send PHP mail with Attachment with script and function

Hope this code and post will helped you for implement Angular 2 image slider with example and demo . if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  16  =  20

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US