NetanelBasal
1/10/2017 - 4:25 PM

control-errors1.component.ts

get error() {
  const control = this.form.controls[this.control];

  if( control && this.form.submitted ) {
    let firstError;

    Object.keys(this.errors).some(err => {
      if( control.hasError(err) ) {
        firstError = this.errors[err];
        return true;
      }
     });
      
     return firstError;

   }
}