I've searched here and there, and I am not able to find something specific about formatting a phone number.
Currently, I am retrieving phone numbers form a JSON in the following format:
25565115
However, I want to achieve this result:
02-55-65-115
For that, I believe that I need to use a custom pipe and I don't think that there is a built-in one that does it automatically.
Can you please give me some guidance on how to do so?
StackBlitz
pipe
implementation in TS would look like thisDeclare the PhonePipe in your NgModule's declarations
Usage:
There are many things that can be improved, I just made it work for this particular case.