Angular 6: implementación adecuada de ControlValueAccessor

Estoy creando un formulario de reserva simple con el siguiente formulario usando bootstrap 4 y angular 6 e igx-calendar para angular. igx-calendar

HTML.

<form [formGroup]="angForm" class="form-element">
      <div class="col-sm-4 offset-sm-2 about-booking_calendar">
        <div class="form-group form-element_date">
        <app-calendar formControlName="date" #date></app-calendar>
        </div>
      </div>
      <div class="col-sm-4 about-booking_form">
        <div class="form-group form-element_email">
          <input type="email" class="form-control info" placeholder="Email" formControlName="email" #email (ngModelChange)="onChange($event)">
        </div>
        <div *ngIf="angForm.controls['email'].invalid && (angForm.controls['email'].dirty || angForm.controls['email'].touched)"
          class="alert alert-danger">
          <div *ngIf="angForm.controls['email'].errors.required">
            Email is required.
          </div>
        </div>
        <div class="input-group mb-3 form-element_city">
          <select class="custom-select" id="inputGroupSelect01" #cityName>
            <option selected *ngFor="let city of cities" [ngValue]="city.name">{{city.name}}</option>

          </select>
        </div>
        <div class="input-group mb-3 form-element_hotel">
          <select class="custom-select" id="inputGroupSelect01" #hotelName>
            <option selected *ngFor="let hotel of hotels" [ngValue]="hotel.name">{{hotel.name}}</option>

          </select>
        </div>
        <div class="form-group">
          <button type="submit" (click)="addReview(date.value, email.value, cityName.value , hotelName.value)" class="btn btn-primary btn-block form-element_btn"
            [disabled]="!validEmail">Book</button>
        </div>
      </div>
    </form>

calendar component.ts

import { Component, forwardRef, Input, OnInit, ElementRef, ViewChild } from '@angular/core';
import { IgxCalendarComponent, IgxDialogComponent } from 'igniteui-angular';
import { FormControl, ControlValueAccessor, NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
@Component({
  selector: 'app-calendar',
  templateUrl: './calendar.component.html',
  styleUrls: ['./calendar.component.scss'],
  providers: [
    { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CalendarComponent), multi: true }
  ]
})
export class CalendarComponent implements ControlValueAccessor, OnInit {
  @ViewChild('calendar') public calendar: IgxCalendarComponent;
  @ViewChild('alert') public dialog: IgxDialogComponent;
  // tslint:disable-next-line:no-input-rename
  @Input('date') _date;
  @ViewChild('date') private elDate: ElementRef;
  instance;
  propagateChange: any = () => { };
  ngOnInit() {
    this.instance = this.calendar(this.elDate.nativeElement, {
      defaultDate: this.date,
      onChange: (selectedDates, dateStr, instance) => {
        this.date = selectedDates[0];
      }
    });
  }
  get date() {
    return this._date;
  }

  set date(val) {
    this._date = val;
    this.propagateChange(val);
  }

  writeValue(value) {
    if (value) {
      this.date = value;
      this.instance.setDate(this.date, true);
    }
  }

  registerOnChange(fn) {
    this.propagateChange = fn;
  }

  registerOnTouched() { }

  public verifyRange(dates: Date[]) {
    if (dates.length > 5) {
      this.calendar.selectDate(dates[0]);
      this.dialog.open();
    }
  }
}

NB: Aquí está visual del formulario:

Obtengo el siguiente error en la consola al compilar, el problema está en esta línea al principio:

  ngOnInit() {
    this.instance = this.calendar(this.elDate.nativeElement, {
      defaultDate: this.date,
      onChange: (selectedDates, dateStr, instance) => {
        this.date = selectedDates[0];
      }
    });
  }

Para referencia, utilicé este método en este enlace: next.plnkr.co/edit/okIjPb6aUcrzx3t7edae?p=info&preview usan flatpickr. Utilizo igx-calendar de:

Error: no se puede invocar una expresión cuyo tipo carece de una firma de llamada. El tipo 'IgxCalendarComponent' no tiene firmas de llamada compatibles.

Solo quiero que el usuario seleccione una fecha y complete el formulario como correo electrónico, ciudad, hotel y pueda enviar el formulario.

¿Qué tiene de malo mi código? por favor ayuda, estoy aprendiendo todo esto.

Respuestas a la pregunta(0)

Su respuesta a la pregunta