khashayar / ng-trim-value-accessor

Angular's (missing) trim accessor to automatically trim values of input fields
MIT License
53 stars 19 forks source link

Unable to use [(ngModel)] in mat-autocomplete when ng-trim-value-accessor is used #22

Closed lahiruchandima closed 6 years ago

lahiruchandima commented 6 years ago

When I try to add [(ngModel)] directive to mat-autocomplete, I get following warning.

ERROR Error: More than one custom value accessor matches form control with unspecified name attribute

This warning gets fixed if I remove the TrimValueAccessorModule import to my module.

I can disable TrimValueAccessorModule for the mat-autocomplete by adding class="ng-trim-ignore" attribute to the input element of mat-autocomplete and fix the warning, but it would be better if TrimValueAccessorModule could work with mat-autocomplete without a problem.

khashayar commented 6 years ago

Duplicate of #17

It's an Angular limitation which doesn't allow to attach more than one custom value accessor to one form element.