title: Angular 2 Pass parameter to a validator function
body: <p>I have an array in my formcomponent class and want to be able to pass that array to a validator function. When adding multiple validators to the form, I am using Validators.compose function. This only accepts the name of the validator function though, and not any parameters to pass. Is it possible to add parameters to the function calls inside of the "compose" function?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>export class ClientFormComponent
  {
      clientForm: ControlGroup;
      npi: AbstractControl;
      name: AbstractControl;
  
      constructor(private _clientService: ClientService, _fb: FormBuilder) {
          this.clientForm = _fb.group({ 'name': ['', Validators.compose([Validators.required])], 'npi': ['', Validators.compose([Validators.required, npiNumValidator, Validators.maxLength(10), Validators.minLength(10)])]});
          this.name = this.clientForm.controls['name'];
          this.npi = this.clientForm.controls['npi'];
      }
      
      @Input() clientList;
      active = true;   
     
      onSubmit(value: Client) {
          this._clientService.addDeleteClient(value, true)
              .subscribe(
              client =&gt; this.clientList.push(client));        
      }    
  }
  
  function npiNumValidator(control: Control): { [s: string]: boolean } {
      if (isNaN(control.value)) {
          return { npiNAN: true };
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thanks for any help!</p>