-
-
-
-
-
-
-
-
+
Previous
-
+
Next
diff --git a/src/app/carousel/carousel.component.ts b/src/app/carousel/carousel.component.ts
index 5e8cf41..408e272 100644
--- a/src/app/carousel/carousel.component.ts
+++ b/src/app/carousel/carousel.component.ts
@@ -1,15 +1,23 @@
-import { Component, OnInit } from '@angular/core';
+import { Component } from '@angular/core';
@Component({
selector: 'app-carousel',
templateUrl: './carousel.component.html',
styleUrls: ['./carousel.component.css']
})
-export class CarouselComponent implements OnInit {
+export class CarouselComponent {
- constructor() { }
+ slide = 0;
- ngOnInit() {
+ constructor() {
+ setInterval(() => this.nextSlide(), 5000);
}
+ nextSlide() {
+ this.slide = (this.slide + 1) % 3 ;
+ }
+
+ previousSlide() {
+ this.slide = (this.slide === 0 ? 2 : this.slide -1);
+ }
}