3

Suppose I create a reactive form like the following:

public form: FormGroup;

ngOnInit() {
    this.form = new FormGroup({ myControl: new FormControl() });
}

I want to be able to dynamically (from code and not template) bind the control to an event. Something like this:

this.form.controls['myControl'].bind('blur', someMethod());

How is it possible with Angular 2?

Dilip Raj Baral
  • 3,060
  • 6
  • 34
  • 62

1 Answers1

-2

You can call a function for that form control like

<textarea #urlcontent formControlName="content" (blur)="validateEmbedUrl(urlcontent.value)"></textarea>
Pooja
  • 356
  • 2
  • 11