add sorting for gallery

This commit is contained in:
2019-11-17 09:36:37 +01:00
parent 73ea635ac1
commit 70fb84d634
14 changed files with 310 additions and 13 deletions

View File

@@ -0,0 +1,38 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'pdb-image-toggle',
templateUrl: './image-toggle.component.html',
styleUrls: ['./image-toggle.component.scss']
})
export class ImageToggleComponent implements OnInit {
@Input()
images : string = "";
value: number = 0;
@Output()
valueChanged : EventEmitter<number> = new EventEmitter<number>();
_states : Array<any>;
constructor() { }
ngOnInit() {
this._states = JSON.parse(this.images);
}
imageUrl() : string {
return this._states[this.value].imageUrl;
}
title() : string {
return this._states[this.value].title;
}
toggle(event){
this.value = (this.value+1) % this._states.length;
this.valueChanged.emit(this.value);
}
}