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

Create tippy Programmatically #102

Closed
rmpt opened this issue Jun 21, 2022 · 4 comments
Closed

Create tippy Programmatically #102

rmpt opened this issue Jun 21, 2022 · 4 comments

Comments

@rmpt
Copy link

rmpt commented Jun 21, 2022

I'm submitting an issue


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[x] Documentation issue or request
[x] Support request
[ ] Other... Please describe:

Current behavior

The example have a variable conflict, both TippyService and TippyInstance have the same variable name. That's issue one.
After fixing this, when I call:
const myTippyInstance = this.tippyService.create(element, 'this field is required', { arrow: true });

I can't call myTippyInstance.open() because:
Property 'open' does not exist on type 'ExtendedTippyInstance<"this field is required">'.

I've cast the result of create to any but still get the error on the console, but the tooltip shows correctly. What should I do to avoid this crash?

Expected behavior

create function should return a type that allows to call open method right away. Apart of that, the crash is weird in the sense that the tooltip shows, so no error should be shown.

Minimal reproduction of the problem with instructions

Simple angular 13 app applying the simplest example, the one on your github page.

What is the motivation / use case for changing the behavior?

Tooltip over calendar events.

Environment


Angular version: 13.3.2

Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [x] Firefox version 101.0.1
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
@samerkh
Copy link

samerkh commented Feb 13, 2023

why is this ignored? I've always had an issue creating tippy programatically
This part of the documentation is not correct, specifically the declaration of the instance and the service (they both are named tippy)
and there is no .open in tippy instance (.show exists)
and finally when i try tippyService.create(element,'text') i get this error
TypeError: Cannot read properties of undefined (reading 'undefined')
im on angular 13 and helipopper 5.15, overview 3.0.4

@samerkh
Copy link

samerkh commented Feb 13, 2023

@rmpt were you able to solve the issue?

@shaharkazaz
Copy link
Contributor

@rmpt This is only a mistake in the docs. the method should be show. I'll update.

@samerkh I'm not sure what's the issue you are describing, you are welcome to open an issue with a reproduction repo/stackblitz.

@samerkh
Copy link

samerkh commented Feb 14, 2023

@shaharkazaz thanks for your reply. The issue was that I did not import the TippyModule in the AppModule, but rather into a sub module, the general config was not set to the data i provided inside .forRoot(). I fixed the issue by importing the TippyModule inside AppModule.
However, i believe there is still an issue in documentation, i made a PR you can look into.
Thanks!

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

3 participants