angular-ordinal

Angular Ordinal Number Filter

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
angular-ordinal
2.1.38 years ago8 years agoMinified + gzip package size for angular-ordinal in KB

Readme

Angular Ordinal Number Filter
{{numericalValue | ordinal}}
Converts e.g 1 -> 1st, 2 -> 2nd, 3 -> 3rd, 4 -> 4th.

Installation

Via npm (Recommended)
````terminal 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.