I want to be able to optionally add autocomplete to an input.
Currently I have tried adding an *ngIf
to the mat autocomplete tag but it raises errors because the input has the matAutocomplete
property and is looking for the autocomplete component. I have also tried setting matAutocomplete
to null when I want autocomplete off but this did not work.
Here is what I tired:
But I get:
Error: Attempting to open an undefined instance of `mat-autocomplete`.
This is how I want it to work:
But without having to duplicate the input and form field tags.