add filters for gallery

This commit is contained in:
2019-11-17 18:59:08 +01:00
parent 70fb84d634
commit 771f61a597
9 changed files with 227 additions and 17 deletions

View File

@@ -10,29 +10,33 @@ export class ImageToggleComponent implements OnInit {
@Input()
images : string = "";
value: number = 0;
index: number = 0;
@Output()
valueChanged : EventEmitter<number> = new EventEmitter<number>();
text = undefined;
_states : Array<any>;
constructor() { }
ngOnInit() {
this._states = JSON.parse(this.images);
this.text = this._states[this.index].text;
}
imageUrl() : string {
return this._states[this.value].imageUrl;
return this._states[this.index].imageUrl;
}
title() : string {
return this._states[this.value].title;
return this._states[this.index].title;
}
toggle(event){
this.value = (this.value+1) % this._states.length;
this.valueChanged.emit(this.value);
this.index = (this.index+1) % this._states.length;
this.text = this._states[this.index].text;
this.valueChanged.emit(this._states[this.index].value);
}
}