add filters for gallery
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user