/*
 * Option select to use on a custom Select Form Control created by @mmeyer - Martin Meyer
 */

import { Component, OnInit, Input, Output, EventEmitter, HostListener, HostBinding } from '@angular/core';
import { SelectOption } from '../select-option.model';

@Component({
  selector: 'app-select-option',
  templateUrl: './select-option.component.html',
  styleUrls: ['./select-option.component.scss']
})
export class SelectOptionComponent implements OnInit {

  @Input() option: SelectOption;

  @Output() onSelected = new EventEmitter<SelectOption>();

  @HostBinding('class.selected')
  @Input()
  selected: boolean;

  @HostListener('click') onClick() {
    this.onSelected.emit(this.option);
  }

  constructor() { }

  ngOnInit() {
    // this.markSelected = this.selected;
  }

}
