Search code examples
javascriptangulargoogle-places-autocomplete

Angular 4 Error: Cannot find control with unspecified name attribute


I have used google place API following this tutorial but I am getting this error below:

Cannot find control with unspecified name attribute

more detail about error in below screenshot

I have tried also this all hint stackoverflow link

Code

<div class="form-group"> 
<input #search
    type="text"
    placeholder="search for location"
    autocorrect="off"
    autocapitalize="off"
    spellcheck="off"
    class="form-control"
    [formControl]="searchControl"
    name="searchControl"> 
</div> 

Solution

  • You should post some code, we're not mediums !

    But seeing your error, I would say you're using reactive forms, and you forgot to create your reactive forms.

    This means on your input, you have [formControl]="" or formControlName="" attribute, which can't find the corresponding variable.

    Could you post the related code of that please ?