Angular TypeError: text.replace is not a function. ng-repeat Give this a try see what comes up : text.toString().replace(/.(?=.{4})/g, 'X')