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

Added separator, decimal, useGrouping and useEasing options support #6

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions dist/countup-angularjs-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@
if ((attrs.animationLength != null) && isFinite(attrs.animationLength)) {
animationLength = attrs.animationLength;
}
if (attrs.separator != null) {
opts.separator = attrs.separator;
}
if (attrs.decimal != null) {
opts.decimal = attrs.decimal;
}
if (attrs.useGrouping != null) {
opts.useGrouping = attrs.useGrouping === 'true' ? true : false;
}
if (attrs.useEasing != null) {
opts.useEasing = attrs.useEasing === 'true' ? true : false;
}
if (newVal == null) {
newVal = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions dist/countup-angularjs-directive.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/countup-angularjs-directive.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ angular.module('ngCountup', [])
numDecimals = attrs.numDecimals
if attrs.animationLength? and isFinite attrs.animationLength
animationLength = attrs.animationLength
if attrs.separator?
opts.separator = attrs.separator;
if attrs.decimal?
opts.decimal = attrs.decimal;
if attrs.useGrouping?
opts.useGrouping = if attrs.useGrouping == 'true' then true else false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just do opts.useGrouping = if attrs.useGrouping == 'true'

if attrs.useEasing?
opts.useEasing = if attrs.useEasing == 'true' then true else false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as previous comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, i don't use CoffeScript so i'm learning with this module 😄 , i must modify this pull then?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

newVal ?= 0
oldVal ?= 0
new CountUp(attrs.id, oldVal, newVal, numDecimals, animationLength, opts).start()