import { Directive , forwardRef } from '@angular/core' ; import { NG_VALIDATORS , Validator , AbstractControl } from '@angular/forms' ; import { inscricaoestadual } from './validator' ; const INSCRICAOESTADUAL_VALIDATOR = { provide : NG_VALIDATORS , useExisting : forwardRef ( ( ) => InscricaoEstadualValidator ) , multi : true } ; @ Directive ( { selector : '[inscricaoestadual][formControlName],[inscricaoestadual][formControl],[inscricaoestadual][ngModel]' , providers : [ INSCRICAOESTADUAL_VALIDATOR ] } ) export class InscricaoEstadualValidator implements Validator { validate ( c ) { return inscricaoestadual ( 'mg' ) ( c ) ; } }