1

I am new to this, so please excuse if I am not getting something obvious here.

Here is the project on Github, if you want to give it a try: https://git.io/vXtWp

Anyhow, I have a simple Angular 2 service that calls YouTube Api, it looks like this:

enter image description here

Then I have an app.component.ts that looks like this: enter image description here

And HTML file:

enter image description here

My application doesn't work though, it shows as loading with following error:

Uncaught Error: Can't resolve all parameters for FormControl: (?, ?, ?). metadata_resolver.js:499

This is what it looks like in the browser: enter image description here

Any ideas what I am doing wrong? I've spent 2 hours, having no luck figuring this issue out...

3
  • 1
    Please add code as text, not as screenshots. Commented Oct 30, 2016 at 17:00
  • Do you have FormControl somewhere as constructor parameter?. Why do you list it in providers: []? Commented Oct 30, 2016 at 17:03
  • I've added a Github repo to description, if someone wants to give it a try. Commented Oct 30, 2016 at 18:03

1 Answer 1

2
<input [FormControl]="search">

should be

<input [formControl]="search">
        ^

This needs to be the selector or input name of a directive or component, not the class name.

FormControl should be removed from imports: [...] in @NgModule(). Only modules should be listed in imports of @NgModule() not individual classes.

There is no need to list ReactiveFormsModule in providers. Adding it to import is enough.

Sign up to request clarification or add additional context in comments.

5 Comments

I've done what you said and it still doesn't work for some reason... here is the project on Github, can you please take a look? git.io/vXtWp
Why do you have FormControl added to providers:? Can you please try adding FormsModule in addition to ReactiveFormsModule to imports?
Removed FormControl from providers imports. I added FormsModule to imports... it's still doesn't do anything, errors ...
The exact same error as you explained in your question or a different error? The code in your repo seemed fine to me besides what I already mentioned.
Couple of other errors, which were fixed by doing: import 'rxjs/add/operator/debounceTime'; import 'rxjs/add/operator/switchMap'; and import 'rxjs/add/operator/map'; ... then it all started to work... Thanks for all your help, much appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.