angular-ordinal

2.1.3 • Public • Published

Angular Ordinal Number Filter

{{numericalValue | ordinal}}

Converts e.g 1 -> 1st, 2 -> 2nd, 3 -> 3rd, 4 -> 4th.

Installation

Via npm (Recommended)

npm install --save angular-ordinal

This filter can also be installed through Bower:

bower install angularjs-ordinal-filter --save

Load the script:

<script src="<path-to>/ordinal-browser.js"></script> 

Include the module as a dependency in your app:

angular.module('MyApp', ['ordinal']);

Usage

In your template:

{{numericalValue | ordinal}}

In your JS:

angular.module('MyApp').controller('$scope', '$filter', function($scope, $filter) {
    var ordinal = $filter('ordinal');
 
    $scope.dayOfMonth = ordinal(1); // => 1st
});

License

Licensed under the MIT License.

/angular-ordinal/

    Package Sidebar

    Install

    npm i angular-ordinal

    Weekly Downloads

    2,979

    Version

    2.1.3

    License

    MIT

    Last publish

    Collaborators

    • jdpedrie