0

I have the following simple html

<body ng-app="mainModule">
<div ng-controller="mainController">
<input type="text" ng-model="textValue" ng-change="onTextChange(textValue)"/>
{{isTextChanged|ch}}
</div>
</body>

Js

angular.module("mainModule", [])
   .filter('ch', function() {
       return function(input) {
           input = input.replace('a', '');
           return input;
       };
   })
   .controller("mainController", function ($scope)
   {
       $scope.onTextChange = function (txt)
       {
           $scope.isTextChanged = txt
       };

   });

The problem im facing is that angular changes only the first instance of the letter 'a'

dave
  • 62,300
  • 5
  • 72
  • 93
Ando
  • 1,802
  • 4
  • 25
  • 47

0 Answers0