kadoshms / ionic2-autocomplete

Ionic 2 autocomplete component
MIT License
149 stars 108 forks source link

No provider for CompleteTestService! #167

Open AhmadKassem89 opened 5 years ago

AhmadKassem89 commented 5 years ago

Hello,

I've followed your instruction but i've faced some issues. I'm working on a lazy loading page, so i've imported AutoCompleteModule on my lazypage.module.tsfile. Then i imported CompleteTestService on my lazypage.ts file.

I'm getting the following error:

Uncaught (in promise): Error: StaticInjectorError(AppModule)[LazyPage -> CompleteTestService]: StaticInjectorError(Platform: core)[LazyPage -> CompleteTestService]: NullInjectorError: No provider for CompleteTestService! Error: StaticInjectorError(AppModule)[LazyPage -> CompleteTestService]: StaticInjectorError(Platform: core)[LazyPage -> CompleteTestService]: NullInjectorError: No provider for CompleteTestService!

My CompleteTestService file looks like the one you provided in the instruction page.

Any help will be appreciated!

AhmadKassem89 commented 5 years ago

I've tried this on a new empty project. I got this error TypeError: Cannot read property 'getResults' of undefined

I'm working on ionic 3 btw

AhmadKassem89 commented 5 years ago

I've used another component (ng2-completer) to finish up with my application, but this need to be fixed !

fareshan commented 5 years ago

It seems like I am having the same issue. I am getting this error:

ERROR Error: Uncaught (in promise): Error: StaticInjectorError[CompleteTestService]: StaticInjectorError[CompleteTestService]: NullInjectorError: No provider for CompleteTestService! Error: StaticInjectorError[CompleteTestService]: StaticInjectorError[CompleteTestService]: NullInjectorError: No provider for CompleteTestService!

karlerikounapuu commented 5 years ago

I'm getting this error too when ionic is ran in development mode, haven't tried production though. What seems to temporarily fix the issue is when you modify/save the provider class and ionic rebuilds the components.

fareshan commented 5 years ago

@karlerikounapuu if you mean that you found a workaround, can you explain what is it ? what do you mean by modify / save the provider ?

mor-david commented 5 years ago

I ran into the same issue. Here is how I solved it: import { CompleteTestService } from '../providers/CompleteTestService'; into your app.module.ts file. Add CompleteTestService to the providers in app.module.ts

jrquick17 commented 5 years ago

Since this project is not actively maintained I have fixed this issue and others in a forked repository.

Ionic4-auto-complete