Giter Club home page Giter Club logo

countup-angularjs-directive's Introduction

Original blog post here: http://www.andrewboni.com/2014/09/03/a-countupjs-angularjs-directive/

About

This is an AngularJS directive for the countUp.js library.

Dependencies

  • AngularJS
  • countUp.js

Installation

Install via Bower:

bower install -S countup-angularjs-directive

or NPM:

npm install countup-angularjs-directive

Then, add the module name to your app.js or app.coffee file:

modules = [
  ...
  'ngCountup'
  ...
]
angular.module('myApp', modules).run(...)

...and include the file dist/countup-angularjs-directive.min.js somewhere on your page, after angular and countUp.

Like so:

   <head>
       <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
       <script src="js/app.js"></script>
       <script src="../bower_components/countUp.js/countUp.min.js"></script>
       <script src="../dist/countup-angularjs-directive.min.js"></script>
   </head>

Usage

<h1 count-up id="opens" ng-model="dynamicStats.opens"></h1>

Note that you need the attribute count-up, ng-model, as well as an id. The count-up attribute is self explanatory, while the ng-model is the numerical value to apply the countUp effect to. The id is necessary for countUp itself- it doesn't matter what the name of the id is.

Optionally, you can configure the number of decimals and the animation length (in seconds) like so:

<h1 count-up id="opens" ng-model="dynamicStats.opens" data-num-decimals="2" data-animation-length="10"></h1>

This directive is a work in progress- there are probably a ton of optimizations that can be made. If you have any suggestions, please submit a pull request!

Development

Run grunt dev to build/uglify the dist files from src and watch src files for changes. Run grunt build to merely build and uglify from src.

Server

Run http-server to get a lightweight server up and running.

#MIT License

countup-angularjs-directive's People

Contributors

andrewboni avatar fxckdead avatar vuk avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.