Search code examples
angulartypescriptangular-pipe

Align Phone Number With Angular Pipe


I am trying to beautify phone number(999 999 9999) and display with Angular Pipe. Is there is any pipe to do that? Please help me out

TS

public phone;
this.phone = 9999999999;

HTML

<h1>{{phone | ?? }}</h1>

Solution

  • You can do it with angular ‘slice’ pipe. Exp:

    {{ phone | slice:0:2 }} - {{ phone | slice:3:5 }}

    like that...