liuy97 / ng2-input-autocomplete

angular2 input autocomplete
https://liuy97.github.io/ng2-input-autocomplete/
MIT License
7 stars 5 forks source link

Add control prop for reactive forms #20

Closed DanWebb closed 5 years ago

DanWebb commented 5 years ago

This PR adds a control prop to the input-autocomplete directive.

Currently, using reactive forms it's not possible to programmatically update the value of the input as you would expect.

For example, using this.formGroup.controls.formControl.setValue('') will not update the AutocompletComponent it will only update the original input underneath it.

With this update if you're using reactive forms, you can now pass the FormControl into the input as a prop like <input input-autocomplete [control]="formControl"> for FormControl methods such as setValue or reset to work.