angular-ordinal
v2.1.3
Published
Angular Ordinal Number Filter
Downloads
8,026
Maintainers
Readme
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.