angularjs-ordinal-filter

Ordinal Number filter for Angular

Angular Core Dependency: *

Module License: MIT

Added by: Sam Deering

GitHub

Repository

jdpedrie/angularjs-ordinal-filter

Stats

Stars: 53

Watchers: 53

Forks: 11

Module Description

AngularJS Ordinal Number Filter

{{numericalValue | ordinal}}

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

Hat tip

The snippet to create an ordinal number was found online here

Installation

This filter can 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
});

Hopefully someone finds this useful!

Module stats last updated: 2017-05-12 15:00:04

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!