All files / src/app/shared/components/confirmation-modal confirmation-modal.component.ts

78.95% Statements 15/19
62.5% Branches 5/8
60% Functions 3/5
76.47% Lines 13/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 4498x 98x   98x             98x                     1x   1x 1x     98x 1x 1x     98x             98x     98x  
import { Component, OnInit, TemplateRef } from '@angular/core';
import { FormGroup } from '@angular/forms';
 
import { BsModalRef } from 'ngx-bootstrap/modal';
 
@Component({
  selector: 'cd-confirmation-modal',
  template: require('./confirmation-modal.component.html'),
  styles: []
})
export class ConfirmationModalComponent implements OnInit {
  bodyData: object;
  bodyTpl: TemplateRef<any>;
  buttonText: string;
  onSubmit: Function;
  onCancel: Function;
  titleText: string;
 
  bodyContext: object;
  confirmationForm: FormGroup;
 
  boundCancel = this.cancel.bind(this);
 
  constructor(public modalRef: BsModalRef) {
    this.confirmationForm = new FormGroup({});
  }
 
  ngOnInit() {
    this.bodyContext = this.bodyContext || {};
    this.bodyContext['$implicit'] = this.bodyData;
  }
 
  cancel() {
    this.modalRef.hide();
    if (this.onCancel) {
      this.onCancel();
    }
  }
 
  stopLoadingSpinner() {
    this.confirmationForm.setErrors({ cdSubmitButton: true });
  }
}