Angular 4 Error: Cannot find control with unspecified name attribute

gauravbhai daxini picture gauravbhai daxini · Dec 14, 2017 · Viewed 27.8k times · Source

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> 

Answer

user4676340 picture user4676340 · Dec 14, 2017

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 ?