Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

I'm new to Angular, and would like to implement the same easy function extension in JQuery, but use directive (as far as i understand this is how it supposed to be done).

does somone know ready implimentation?

my search ended up only with JQuery solutions and i don't know how to convert it to Angular.

this is what i needed to do:

link to example: http://jsfiddle.net/YWn9t/

can you help?

function declaration:

$.fn.countTo.defaults = {
    from: 0,  // the number the element should start at
    to: 100,  // the number the element should end at
    speed: 1000,  // how long it should take to count between the target numbers
    refreshInterval: 100,  // how often the element should be updated
    decimals: 0,  // the number of decimal places to show
    onUpdate: null,  // callback method for every time the element is updated,
    onComplete: null,  // callback method for when the element finishes updating
};

how to use:

jQuery(function($) {
        $('.timer').countTo({
            from: 50,
            to: 2500,
            speed: 5000,
            refreshInterval: 50,
            onComplete: function(value) {
                console.debug(this);
            }
        });
    });

html:

<span class="timer"></span>

taken from: stackoverflowstackoverflow

I'm new to Angular, and would like to implement the same easy function extension in JQuery, but use directive (as far as i understand this is how it supposed to be done).

does somone know ready implimentation?

my search ended up only with JQuery solutions and i don't know how to convert it to Angular.

this is what i needed to do:

link to example: http://jsfiddle.net/YWn9t/

can you help?

function declaration:

$.fn.countTo.defaults = {
    from: 0,  // the number the element should start at
    to: 100,  // the number the element should end at
    speed: 1000,  // how long it should take to count between the target numbers
    refreshInterval: 100,  // how often the element should be updated
    decimals: 0,  // the number of decimal places to show
    onUpdate: null,  // callback method for every time the element is updated,
    onComplete: null,  // callback method for when the element finishes updating
};

how to use:

jQuery(function($) {
        $('.timer').countTo({
            from: 50,
            to: 2500,
            speed: 5000,
            refreshInterval: 50,
            onComplete: function(value) {
                console.debug(this);
            }
        });
    });

html:

<span class="timer"></span>

taken from: stackoverflow

I'm new to Angular, and would like to implement the same easy function extension in JQuery, but use directive (as far as i understand this is how it supposed to be done).

does somone know ready implimentation?

my search ended up only with JQuery solutions and i don't know how to convert it to Angular.

this is what i needed to do:

link to example: http://jsfiddle.net/YWn9t/

can you help?

function declaration:

$.fn.countTo.defaults = {
    from: 0,  // the number the element should start at
    to: 100,  // the number the element should end at
    speed: 1000,  // how long it should take to count between the target numbers
    refreshInterval: 100,  // how often the element should be updated
    decimals: 0,  // the number of decimal places to show
    onUpdate: null,  // callback method for every time the element is updated,
    onComplete: null,  // callback method for when the element finishes updating
};

how to use:

jQuery(function($) {
        $('.timer').countTo({
            from: 50,
            to: 2500,
            speed: 5000,
            refreshInterval: 50,
            onComplete: function(value) {
                console.debug(this);
            }
        });
    });

html:

<span class="timer"></span>

taken from: stackoverflow

Source Link
Liad Livnat
  • 7.5k
  • 17
  • 62
  • 98

AngularJS counter to count up to a target number

I'm new to Angular, and would like to implement the same easy function extension in JQuery, but use directive (as far as i understand this is how it supposed to be done).

does somone know ready implimentation?

my search ended up only with JQuery solutions and i don't know how to convert it to Angular.

this is what i needed to do:

link to example: http://jsfiddle.net/YWn9t/

can you help?

function declaration:

$.fn.countTo.defaults = {
    from: 0,  // the number the element should start at
    to: 100,  // the number the element should end at
    speed: 1000,  // how long it should take to count between the target numbers
    refreshInterval: 100,  // how often the element should be updated
    decimals: 0,  // the number of decimal places to show
    onUpdate: null,  // callback method for every time the element is updated,
    onComplete: null,  // callback method for when the element finishes updating
};

how to use:

jQuery(function($) {
        $('.timer').countTo({
            from: 50,
            to: 2500,
            speed: 5000,
            refreshInterval: 50,
            onComplete: function(value) {
                console.debug(this);
            }
        });
    });

html:

<span class="timer"></span>

taken from: stackoverflow