Ordinal numbers

ordinalNumber scans a string for cardinal numbers and rewrites each one as its ordinal form (1 → 1st, 2 → 2nd, …). Pass the four locale suffixes as arguments so the pipe is fully i18n-friendly.

Basic usage

This is the 1st demo of how you can use the BsOrdinalNumberPipe. The 2nd and 3rd demo also work as expected.
  
    
      
        <span [innerHTML]="text | ordinalNumber: 'st':'nd':'rd':'th'"></span>
        
    
  
    
      
        import { Component } from '@angular/core';
        
    
      
        import { BsOrdinalNumberPipe } from '@mintplayer/ng-bootstrap/ordinal-number';
        
    
      
        
        
    
      
        @Component({
        
    
      
          selector: 'my-ordinal-demo',
        
    
      
          templateUrl: './my-ordinal-demo.component.html',
        
    
      
          imports: [BsOrdinalNumberPipe],
        
    
      
        })
        
    
      
        export class MyOrdinalDemoComponent {
        
    
      
          protected text = 'The 1st, 2nd, 3rd and 4th places.';
        
    
      
        }