-2

I have 2 pages.In first page i will fill my mobile number.Then,navigating to the second page I will show the mobile number in read only.In that i need to show the number like xxxxxx1234. If user clicks the edit button then,it should show all the numbers like 8790561234.

I couldn't get the masking for read only field.?Any suggestions??

Mathi
  • 139
  • 1
  • 1
  • 10

1 Answers1

2

With slice and replace, you can achieve what you want:

var orig = scope.ngModel;
    var edited = orig;
    scope.ngModel = edited.slice(4).replace(/\d/g, 'x') + edited.slice(-4);

Check out this similar Plunker.

xabi_sides
  • 335
  • 3
  • 20