Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR "No provider for TooltipController" #61

Closed
sertal70 opened this issue Feb 15, 2019 · 3 comments
Closed

ERROR "No provider for TooltipController" #61

sertal70 opened this issue Feb 15, 2019 · 3 comments

Comments

@sertal70
Copy link

Describe the bug
When the app load a page where a tooltip directive is used, the following error happens:

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

I suspect I'm doing something wrong but I cannot identify what it is. Having a look at the example project didn't help me to sort out this.

Thanks for help!

To Reproduce

  1. install the directive (I'm using v3 because of Ionic v3)
    npm i ionic-tooltips@3 --save
  2. add module to app.module.ts
import { TooltipsModule } from 'ionic-tooltips';
...
  imports: [
   ...
    IonicModule.forRoot(MyApp),
    TooltipsModule,
    ...
  1. add a tooltip directive on any html element of the page:
...
<img tooltip='sample text' [event]='hover'/>
...

Expected behavior
When the app is run and the page is displayed, the text "sample text" is displayed if I move the mouse cursor on the image

Desktop (please complete the following information):

  • OS: macOS 10.12.4
  • Browser Safari
  • Version 12.0,.3
  • Angular Version: 5.2.11
@sertal70
Copy link
Author

UPDATE

If I add TooltipController to the list of providers in app.module.ts, the error goes away:

import { TooltipsModule, TooltipController } from 'ionic-tooltips';
...
  imports: [
   ...
    IonicModule.forRoot(MyApp),
    TooltipsModule,
    ...
  ],
  providers: [
   ...
    TooltipController,
   ...
  ]

Why is this not present in the example project?

@ihadeed
Copy link
Member

ihadeed commented Feb 18, 2019

You need to import it in your app.module.ts as TooltipsModule.forRoot()

@ihadeed ihadeed closed this as completed Feb 18, 2019
@sertal70
Copy link
Author

thanks @ihadeed for this, if it is the fix indeed it should be applied to the example project too, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants