izupet / angular2-counto

Angular 2 package for nice count animations
MIT License
40 stars 13 forks source link

Can this directive work with dynamic values rather than hard coded values. #22

Closed navcoder6 closed 6 years ago

navcoder6 commented 6 years ago

The place where I am using this directive shows a count of messages that is dynamically calculated based on the number returned from back-end API. So instead of [countFrom] and [countTo] hardcoded in html. Can I set them such that whenever count changes from a number to another UI increases or decreases the number in animated form?

izupet commented 6 years ago

Of course. You can apply variables from component to [countFrom] and [countTo] events.

simple example: [countTo]="numberOfMessagesFromAPI"

in component: numberOfMessagesFromAPI = 10;

navcoder6 commented 6 years ago

I did it but it doesn't seem to work. Will it be possible for you to share a working demo for the same on Stackblitz or Codepen?

izupet commented 6 years ago

You have an example in gh-pages branch.

navcoder6 commented 6 years ago

Got it working. Thanks :)