Skip to content
Advertisement

How to use the angular decimal pipe in typscript

I’m using the angular decimal pipe like this:

JavaScript

How can I use the same pipe but on a typescript function?

Advertisement

Answer

I found in a similar question how to use it: just need to import DecimalPipe from @angular/commun and use it as a service:

JavaScript

Also, make sure you add the DecimalPipe to your providers angular module:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement