@@ -103,7 +103,7 @@ export class SampleComponent implements OnInit {
103103export class NguCarouselStore {
104104 type: string;
105105 deviceType: DeviceType;
106- classText : string;
106+ token : string;
107107 items: number;
108108 load: number;
109109 deviceWidth: number;
@@ -206,18 +206,30 @@ This is HTML I'm using in the carousel. Add your own css according to this eleme
206206
207207<ngu-carousel
208208 [inputs] =" carouselBanner"
209- [moveToSlide] = " 2 "
209+ (initData) = " initDataFn($event) "
210210 (onMove) =" onmoveFn($event)"
211211 (carouselLoad) =" loadItemsFn()" >
212212</ngu-carousel >
213213
214214```
215215
216216* ` inputs ` is an ` Input ` and It accepts ` NguCarousel ` .
217- * ` moveToSlide ` is an ` Input ` which accepts point numbers. Numbers represents no of slide to be done .
217+ * ` initData ` is an ` Output ` which triggered on carousel init and it emits token to exchange with service to contol the carousel .
218218* ` onMove ` is an ` Output ` which triggered on every slide before start and it will emit ` $event ` as ` NguCarouselStore ` object.
219219* ` carouselLoad ` is an ` Output ` which triggered when slide reaches the end on items based on inputs ` load ` .
220220
221+
222+ ##Carousel Service
223+
224+ ``` javascript
225+ import { NguCarouselService } from ' @ngu/carousel' ;
226+ ```
227+ This carousel Service supports:
228+
229+ * ` reset(token) ` - This function will reset the carousel
230+ * ` moveToSlide(token, index, animate) ` - This function is used to move to index with animation control.
231+
232+
221233# Getstarted guide
222234
223235## Banner with Custom point style
@@ -231,7 +243,6 @@ import { NguCarousel, NguCarouselStore } from '@ngu/carousel';
231243 template: `
232244 <ngu-carousel
233245 [inputs]="carouselBanner"
234- [moveToSlide]="1"
235246 (onMove)="onmoveFn($event)">
236247
237248 <ngu-item NguCarouselItem class="bannerStyle">
@@ -337,17 +348,18 @@ export class Sample implements OnInit {
337348
338349```
339350
340- ## Tile
351+ ## Tile with Service
341352
342353``` javascript
343354import { Component } from ' @angular/core' ;
344- import { NguCarousel } from ' @ngu/carousel' ;
355+ import { NguCarousel , NguCarouselStore , NguCarouselService } from ' @ngu/carousel' ;
345356
346357@Component ({
347358 selector: ' app-carousel' ,
348359 template: `
349360 <ngu-carousel
350361 [inputs]="carouselTile"
362+ (initData)="initDataFn($event)"
351363 (carouselLoad)="carouselTileLoad($event)">
352364
353365 <ngu-tile NguCarouselItem *ngFor="let Tile of carouselTileItems">
@@ -357,6 +369,7 @@ import { NguCarousel } from '@ngu/carousel';
357369 <button NguCarouselPrev class='leftRs'><</button>
358370 <button NguCarouselNext class='rightRs'>></button>
359371 </ngu-carousel>
372+ <button (click)="resetFn()">Reset</button>
360373 ` ,
361374 styles: [`
362375
@@ -392,10 +405,13 @@ import { NguCarousel } from '@ngu/carousel';
392405 ` ]
393406})
394407export class Sample implements OnInit {
408+ private carouselToken: string;
395409
396410 public carouselTileItems: Array < any> ;
397411 public carouselTile: NguCarousel;
398412
413+ constructor (private carousel : NguCarouselService ) { }
414+
399415 ngOnInit (){
400416 this .carouselTileItems = [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ];
401417
@@ -413,6 +429,18 @@ export class Sample implements OnInit {
413429 }
414430 }
415431
432+ initDataFn (key : NguCarouselStore ) {
433+ this .carouselToken = key .token ;
434+ }
435+
436+ resetFn () {
437+ this .carousel .reset (this .carouselToken );
438+ }
439+
440+ moveToSlide () {
441+ this .carousel .moveToSlide (this .carouselToken , 2 , false );
442+ }
443+
416444 public carouselTileLoad (evt : any ) {
417445
418446 const len = this .carouselTileItems .length
0 commit comments