RC2: Can't resolve all parameters for Service


#1

I’m encountering a strange problem that I can’t figure out.
I keep getting this error: Uncaught Error: Can’t resolve all parameters for NavigationPageService: (?).
I have made a small repo to reproduce the issue here: https://github.com/Katur7/resolveErrorIonic

The app has one page that uses a provider called NavigationPageService. NavigationPageService uses SettingsService.
It looks like the NavigationPageService can’t find the SettingsService and I get the error.

The app works if NavigationPageService does not use SettingsService.
I have also tried removing SettingsService from NavigationPageService and using it in the page and that worked.

Is there something that I’m missing? Can a provider not use another provider?


#2

That’s not a problem, but the whole “barrel” fad does seem to be a bit fragile. Try importing SettingsService directly from where it’s defined or from “…/index” as described here.


#3

Thank you!

Changing from barrel import to explicit import where I had errors fixed it.

Apparently using barrel import is OK in some places (like app.module.ts) but not others, strange