AllAngularWeb Development

Angular Library to convert number to words | Angular Tutorial

A simple angularjs based library to convert number to word, it also support multi language that helps to convert any number into different different languages words.

A multi-language number to word converter that converts any number to words in your Angular app.

Supported Languages:

  • en (English, default)
  • ar (Arabic)
  • cz (Czech)
  • dk (Danish)
  • de (German)
  • es (Spanish)
  • fr (French)
  • fa (Farsi)
  • he (Hebrew)
  • it (Italian)
  • ko (Korean)
  • lt (Lithuanian)
  • lv (Latvian)
  • nl (Dutch)
  • no (Norwegian)
  • pl (Polish)
  • pt (Portuguese)
  • ru (Russian)
  • sr (Serbian)
  • tr (Turkish)
  • uk (Ukrainian)

Install via npm. (Alternative)

Now install ngx-num-to-words via:

npm install --save n2words ngx-num-to-words  

Import the library

If you installed the library via angular schematics, you can skip this step

import { NgxNumToWordsModule } from 'ngx-num-to-words';

@NgModule({

  declarations: [AppComponent, ...],

  imports: [NgxNumToWordsModule, ...], 

  bootstrap: [AppComponent]

})

export class AppModule {

}

Other modules in your application like for lazy loading import NgxNumToWordsModule into your feature module:

API

Using the service

<h1><b>{{numberInWords}}</b></h1>

import { NgxNumToWordsService, SUPPORTED_LANGUAGE } from 'ngx-num-to-words';

numberInWords!: string;

lang!: SUPPORTED_LANGUAGE = 'en';

value = 123;

 constructor(private ngxNumToWordsService: NgxNumToWordsService) {

  }

ngOnInit(): void {

    this.numberInWords = this.ngxNumToWordsService.inWords(value, this.lang);

 }

Using the pipe inWords


<span>{{ 123 | inWords }}</span> // default en language

<span>{{ 123 | inWords:'de' }}</span> // custom language --> german in this case

See live demo and download source code.
DEMO DOWNLOAD

Don’t forget to Subscribe My Public Notebook for more useful free scripts, tutorials and articles.

One thought on “Angular Library to convert number to words | Angular Tutorial

Leave a Reply

10 Best Artificial Intelligence Software|artificial intelligence tools 5 nft games to earn money | Best NFT games for earn crypto Earn Money From Minting NFTs| How to mint NFT for free Top 10 Things You Need To Know About Python List | python lists functions 10 Popular PHP frameworks for web developers| best php frameworks 12 Tips On How To Become a Python Developer | python For beginner 12 Best Nodejs Frameworks for App Development in 2022 how to create google web stories, Steps to create web stories Top 10 Features in Angular 13 Every Developer Should Know | Angular 13 Features 10 Best Angular UI Libraries | angular ui components | angular Project 10 Best Web Development Frameworks in 2022 Frontend & Backend 18 Best Open-Source and Free Database Software | best database software for beginners Top 10+ Best Java IDEs & Online Java Compilers | best java ide for beginners top 10 besic to andvance java books |java books for beginer Top 5 Themes For Blogger, professional blogger theme download BEST Python Courses Online,Top 10 Courses to Learn Python in 2022 Top 13 python libraries for data science