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

Make the animate function public #72

Closed
obumnwabude opened this issue Jul 4, 2022 · 2 comments · Fixed by #73
Closed

Make the animate function public #72

obumnwabude opened this issue Jul 4, 2022 · 2 comments · Fixed by #73

Comments

@obumnwabude
Copy link
Contributor

[ ] Bug
[ ] Build issue
[*] Feature request

Version info

Angular: 13
Angular CLI: 13
ngx-countup: 13

Description

This is a cool library. Thanks for building it. I've used it in multiple projects.

Currently, there is no way to reanimate the count up when the developer wants to do so. For example, the developer may want to be reanimating after every interval of some seconds. Or the developer may want to reanimate the countUp whenever the countUp is scrolled into view (especially when it is not among the first things the user sees on the page).

Making the private animate() method on the CountUpDirective public should solve this problem. This way the developer can use @ViewChild to select the directive and call animate when they want to.

I was surprised that the method in question was private. Didn't know what motivated making it private in the first place so that's why I opened this issue first, rather than sending a pull request with the change directly.

@inorganik
Copy link
Owner

the countUp instance itself is public, but calling start() on that will trigger a lot of change detection. I think your solution is better, make animate public. I don't know if there was ever a reason for making it private. Would you like to make a PR please?

@obumnwabude
Copy link
Contributor Author

Sure, my pleasure, I'll send the pull request.

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

Successfully merging a pull request may close this issue.

2 participants