import {
  Component,
  ChangeDetectorRef,
  ViewEncapsulation,
  Input,
  OnInit,
  EventEmitter,
  Output,
  ViewChild,
  ElementRef,
  AfterViewInit
} from '@angular/core';
import { Router } from '@angular/router';
import { FinancingOptionsProperties } from '../../interfaces/financing-options-properties-interface';

@Component({
  selector: 'app-financing-options-list',
  templateUrl: './financing-options-list.component.html',
  styleUrls: ['./financing-options-list.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class FinancingOptionsListComponent implements AfterViewInit {
  @Input() financingOptionsItems: FinancingOptionsProperties;
  radioModel: string;
  constructor(private ref: ChangeDetectorRef) {}
  ngAfterViewInit() {
    this.radioModel = this.financingOptionsItems[0].radioValue;
    // console.log(this.radioModel);

    this.ref.detectChanges();
  }

  changeSelection(val: string) {
    this.radioModel = val;
    // console.log(this.radioModel);
  }
}
