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'