main.component.ts 787 Bytes
import { Component, OnInit } from '@angular/core';
import { ImagesService } from 'src/app/services/images.service';
import { AppRoutingModule } from 'src/app/app-routing.module';

@Component({
	selector: 'main',
	templateUrl: './main.component.html',
	styleUrls: ['./main.component.css']
})
export class MainComponent implements OnInit {

	images : string[];
	selected : number = 0;

	constructor(private fetch : ImagesService) { }

	ngOnInit() : void {
		this.images = this.fetch.get();
	}

	select(s : number) : void {
		this.selected = s % this.images.length;
	}

	next() : void {
		this.selected = (this.selected + 1) % this.images.length;
	}

	previous() : void {
		this.selected = (this.selected - 1 + this.images.length) % this.images.length;
	}

	info(i : number) : void {
	}

}