# \[SOLVED\]Cannot resolve all parameters for 'CustomComponent'. Make sure that all the parameters are decorated with Inject

**URL:** <https://forum.ionicframework.com/t/solved-cannot-resolve-all-parameters-for-customcomponent-make-sure-that-all-the-parameters-are-decorated-with-inject/46261>\
**Category:** ionic-v3\
**Created:** [March 12, 2016, 11:23pm UTC](https://forum.ionicframework.com/t/solved-cannot-resolve-all-parameters-for-customcomponent-make-sure-that-all-the-parameters-are-decorated-with-inject/46261 "2016-03-12T23:23:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sp33k3rph433k](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sp33k3rph433k/32/98224_2.png) [@sp33k3rph433k](https://forum.ionicframework.com/u/sp33k3rph433k)\
**Post date:** [March 12, 2016, 11:23pm UTC](https://forum.ionicframework.com/t/solved-cannot-resolve-all-parameters-for-customcomponent-make-sure-that-all-the-parameters-are-decorated-with-inject/46261/1 "2016-03-12T23:23:23Z")

</div>

Hi all!

I’m trying to build an ionic app that’s pretty loosely based on an angular 2 app that I’ve got up and running. In the process, I’m reorganizing a little and running into some problems that I didn’t have on my web app. For example, I get the following error:

`Cannot resolve all parameters for 'DashboardWorkoutComponent'(undefined, HttpClient). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'DashboardWorkoutComponent' is decorated with Injectable.`

Here’s the code I’ve got (into gists so it’s easier to see):

> <https://gist.github.com/camkidman/9f08cf89e00b83043337>

I didn’t have this problem on the angular app, but the user-dashboard page was a component there, so am I not just understanding how to inject components into pages?

Thanks!

---

<div class="post-metadata">

**Author:** ![xr0master](https://avatars.discourse-cdn.com/v4/letter/x/b4bc9f/32.png) [@xr0master](https://forum.ionicframework.com/u/xr0master)\
**Post date:** [March 12, 2016, 11:47pm UTC](https://forum.ionicframework.com/t/solved-cannot-resolve-all-parameters-for-customcomponent-make-sure-that-all-the-parameters-are-decorated-with-inject/46261/2 "2016-03-12T23:47:52Z")

</div>

You need provide APIService into component or you need use something this:  
`providers: [CORE_DIRECTIVES, HttpClient, APIService], directives: [DashboardWorkoutComponent)]`

Your singleton APIService isn’t created.

---

<div class="post-metadata">

**Author:** ![big\_bill91](https://avatars.discourse-cdn.com/v4/letter/b/f4b2a3/32.png) [@big\_bill91](https://forum.ionicframework.com/u/big_bill91)\
**Post date:** [March 14, 2016, 9:37am UTC](https://forum.ionicframework.com/t/solved-cannot-resolve-all-parameters-for-customcomponent-make-sure-that-all-the-parameters-are-decorated-with-inject/46261/3 "2016-03-14T09:37:30Z")

</div>

I have the same error here, i provide my service to providers and into my component but the same error shown

Need help

---

<div class="post-metadata">

**Author:** ![xr0master](https://avatars.discourse-cdn.com/v4/letter/x/b4bc9f/32.png) [@xr0master](https://forum.ionicframework.com/u/xr0master)\
**Post date:** [March 14, 2016, 8:52pm UTC](https://forum.ionicframework.com/t/solved-cannot-resolve-all-parameters-for-customcomponent-make-sure-that-all-the-parameters-are-decorated-with-inject/46261/4 "2016-03-14T20:52:16Z")

</div>

No code - no solution )

---

<div class="post-metadata">

**Author:** ![sp33k3rph433k](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sp33k3rph433k/32/98224_2.png) [@sp33k3rph433k](https://forum.ionicframework.com/u/sp33k3rph433k)\
**Post date:** [March 15, 2016, 12:52am UTC](https://forum.ionicframework.com/t/solved-cannot-resolve-all-parameters-for-customcomponent-make-sure-that-all-the-parameters-are-decorated-with-inject/46261/5 "2016-03-15T00:52:11Z")

</div>

I added this into `app/components/dashboard-workout.component.ts` like you mentioned @xr0master and I still get the same error:

```auto
  providers: [CORE_DIRECTIVES, HttpClient, APIService],
  directives: [DashboardWorkoutComponent]

```

---

<div class="post-metadata">

**Author:** ![xr0master](https://avatars.discourse-cdn.com/v4/letter/x/b4bc9f/32.png) [@xr0master](https://forum.ionicframework.com/u/xr0master)\
**Post date:** [March 15, 2016, 1:09pm UTC](https://forum.ionicframework.com/t/solved-cannot-resolve-all-parameters-for-customcomponent-make-sure-that-all-the-parameters-are-decorated-with-inject/46261/6 "2016-03-15T13:09:22Z")

</div>

Man, I am strongly recommend you read Angular 2 docs.

My code fix your user-dashboard.ts. I don’t said you put it to component 😉

---

<div class="post-metadata">

**Author:** ![sp33k3rph433k](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sp33k3rph433k/32/98224_2.png) [@sp33k3rph433k](https://forum.ionicframework.com/u/sp33k3rph433k)\
**Post date:** [March 15, 2016, 5:34pm UTC](https://forum.ionicframework.com/t/solved-cannot-resolve-all-parameters-for-customcomponent-make-sure-that-all-the-parameters-are-decorated-with-inject/46261/7 "2016-03-15T17:34:26Z")

</div>

@xr0master My apologies, I misunderstood which file you meant. Can you point me in the direction of this specific documentation? Would that be dependency injection?

I also did the above in `app/pages/user-dashboard/user-dashboard.ts` and it gave me the same error.

---

<div class="post-metadata">

**Author:** ![xr0master](https://avatars.discourse-cdn.com/v4/letter/x/b4bc9f/32.png) [@xr0master](https://forum.ionicframework.com/u/xr0master)\
**Post date:** [March 15, 2016, 7:38pm UTC](https://forum.ionicframework.com/t/solved-cannot-resolve-all-parameters-for-customcomponent-make-sure-that-all-the-parameters-are-decorated-with-inject/46261/8 "2016-03-15T19:38:30Z")

</div>

Um… it is strange… So, a service is singleton but something must create service instance. At time, when you call your component, the service still isn’t created. You need use provide (once), that it creates the instance of service. Your project has dependency loop, and it is your issue.

Sorry for my bad English )

I recommend  
**CASE STUDY: TOUR OF HEROES** is very good.  
and after this read dependency injection.

PS ionic does bootstrap, so if you want create service for all app, you can put the service to app provider.

---

<div class="post-metadata">

**Author:** ![sp33k3rph433k](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sp33k3rph433k/32/98224_2.png) [@sp33k3rph433k](https://forum.ionicframework.com/u/sp33k3rph433k)\
**Post date:** [March 17, 2016, 6:46pm UTC](https://forum.ionicframework.com/t/solved-cannot-resolve-all-parameters-for-customcomponent-make-sure-that-all-the-parameters-are-decorated-with-inject/46261/9 "2016-03-17T18:46:21Z")

</div>

Thanks a lot @xr0master. I ended up refactoring it a little and stopped the services from depending on each other and the error went away! So let that be a lesson to me, don’t chain dependencies in your services!
