import { Component , Input , Inject , forwardRef , Host } from "@angular/core" ; import { FormGroup , FormControl } from "@angular/forms" ; @ Component ( { selector : 'display-error' , template : `<div *ngIf="isDisplayed()">
                    <ng-content></ng-content>
               </div>` } ) export class DisplayError { @ Input ( 'formGroup' ) formGroup : FormGroup ; @ Input ( 'control' ) controlName : string ; @ Input ( ) error : string ; control : any ; ngOnInit ( ) { this . control = this . formGroup . get ( this . controlName ) ; } isDisplayed ( ) { return this . control . dirty && this . control . hasError ( this . error ) ; } }