<script>
var app=angular.module("app",[]);
app.filter("frl",function () {
return function (mag,flag) {
return mag.replace(/法|枪/g,flag);
}
});
app.controller("ctr",function ($scope) {
$scope.shu="";
});
</script>
<input type="text" ng-model="shu">
<ul>
<li>{{shu|frl:"*"}}</li>
</ul>