import { Component, OnInit } from '@angular/core'; import { BsModalRef } from 'ngx-bootstrap/modal'; @Component({ selector: 'esp-anomaly-modal', templateUrl: './anomaly.modal.html', styleUrls: ['./anomaly.modal.scss'], }) export class AnomalyModalComponent implements OnInit { data: any; currentAnomaly: any; activeAnomaly = 1; totalAnomaly = 0; constructor(public bsModalRef: BsModalRef) {} ngOnInit() { this.currentAnomaly = this.getCurrentAnomaly(); this.totalAnomaly = this.data.anomaly.length; } onClose(): void { this.bsModalRef.hide(); } getCurrentAnomaly(): object { return this.data.anomaly[this.activeAnomaly - 1]; } prevAnomaly(): void { this.activeAnomaly === 1 ? (this.activeAnomaly = 1) : this.activeAnomaly--; this.currentAnomaly = this.getCurrentAnomaly(); } nextAnomaly(): void { this.activeAnomaly === this.totalAnomaly ? (this.activeAnomaly = this.totalAnomaly) : this.activeAnomaly++; this.currentAnomaly = this.getCurrentAnomaly(); } viewComments(): void { // const featureImportanceData = { // data: { // title: 'Comments', // state: CommentModalState.LIST // filter: null // }, // }; // this.modalService.openCommentsModal({ class: 'modal-comments-custom', initialState: featureImportanceData }); } }