Javascript 如何使用AngularJs从输入或文本区域删除特殊字符?

Javascript 如何使用AngularJs从输入或文本区域删除特殊字符?,javascript,html,angularjs,Javascript,Html,Angularjs,我正在尝试实现AngularJs指令,以从输入和文本区域中删除任何特殊字符,但它不起作用,并且我在控制台中没有看到任何错误。我也有工具提示,当用户向字段添加文本时,它会在工具提示中显示字符数,如果我将下面的文本添加到输入和文本区域,则数字不正确 如果有任何帮助,我将不胜感激。我是AngularJS新手,如何使用Angular指令完成此任务 main.html <textarea rows="2" class="form-control" ng-model="processDTO.p

我正在尝试实现AngularJs指令,以从输入和文本区域中删除任何特殊字符,但它不起作用,并且我在控制台中没有看到任何错误。我也有工具提示,当用户向字段添加文本时,它会在工具提示中显示字符数,如果我将下面的文本添加到输入和文本区域,则数字不正确

如果有任何帮助,我将不胜感激。我是AngularJS新手,如何使用Angular指令完成此任务

main.html

<textarea rows="2" class="form-control"
    ng-model="processDTO.processStatementText"
    name="processStatement" id="processStatement"
    no-special-char
    placeholder="Process Statement" maxlength="4000" required
    data-tooltip-html-unsafe="<div>{{4000 - processDTO.processStatementText.length}} characters left</div>"
    tooltip-trigger="{{{true: 'focus', false: 'never'}[processDTO.processStatementText.length >= 0 || processDTO.processStatementText.length == null ]}}"
    tooltip-placement="top" tooltip-class="bluefill">
</textarea>
doc.text

6.  The Risk/Control reference id is seen on the Process Search grids, but when I search by Risk/Control, I don’t see the corresponding control/risk grid having the ref id column however tool tip has it
7.  The label change “Originating Source System Process/Risk/Control ID” is not done in View/Search Inventory tool tips of Process, Risk, Control grids, It has to be fixed for all the 3 searches “By Process/Risk/Control”
2.  Upload Template Header – Risk Causal and Impact comments are color coded as mandatory but they are optional. Similary the Originating Source System Process/Risk/control ID
3.  In the upload template, for any of the multi value fields, I use an invalid delimiter ‘:’, Eg: 13:7 , for some reason this changes the cell format to time format and thereafter I am not able to give any single values, its always converted to time format. Not sure if this is a training issue, but want to put it on the table to see if it requires any fix at all
4.  In Upload, for the grid field length validations, the filter doesn’t works on Row Number and Max Allowed columns. ~!@#$%^&*()_+|}{:"?><,./';[]\=-0987654321`
5.  ERH All levels added in the View End to End ERH screen – Sort and Filter doesn’t works, After clicking on this field, none of the other filter/sort works on the page. Also the sort indicator(black triangle) is not visible, I believe the column width needs to be adjusted.
6.  The Risk/Control reference id is seen on the Process Search grids, but when I search by Risk/Control, I don’t see the corresponding control/risk grid having the ref id column however tool tip has it
7.  The label change “Originating Source System Process/Risk/Control ID” is not done in View/Search Inventory tool tips of Process, Risk, Control grids, It has to be fixed for all the 3 searches “By Process/Risk/Control”
2.  Upload Template Header – Risk Causal and Impact comments are color coded as mandatory but they are optional. Similary the Originating Source System Process/Risk/control ID
3.  In the upload template, for any of the multi value fields, I use an invalid delimiter ‘:’, Eg: 13:7 , for some reason this changes the cell format to time format and thereafter I am not able to give any single values, its always converted to time format. Not sure if this is a training issue, but want to put it on the table to see if it requires any fix at all
4.  In Upload, for the grid field length validations, the filter doesn’t works on Row Number and Max Allowed columns. ~!@#$%^&*()_+|}{:"?><,./';[]\=-0987654321`
6。风险/控制参考id显示在流程搜索网格上,但当我按风险/控制进行搜索时,我看不到相应的控制/风险网格有ref id列,但工具提示有它
7.“始发源系统流程/风险/控制ID”的标签更改未在流程、风险、控制网格的查看/搜索库存工具提示中完成,必须“按流程/风险/控制”对所有3次搜索进行固定
2.上传模板标题–风险因果和影响评论的颜色编码为必填项,但它们是可选的。与原始来源系统流程/风险/控制ID类似
3.在上载模板中,对于任何多值字段,我使用了无效的分隔符“:”,例如:13:7,由于某种原因,这会将单元格格式更改为时间格式,此后我无法给出任何单个值,它总是转换为时间格式。不确定这是否是一个培训问题,但想把它放在桌面上,看看它是否需要任何修复
4.在上载中,对于网格字段长度验证,筛选器对行数和允许的最大列不起作用。~!@$%^&*()(+)}{:“?>试试这个:

angular.module(“test”,[]).filter(“purger”,function(){
返回函数(输入){
返回输入。替换(/[^\w\s]/gi,“”);
}
}).controller(“testController”,函数($scope,purgerFilter){
$scope.value=purgerFilter(“^..test/$”);
$scope.onChange=函数(){
$scope.value=purgerFilter($scope.value);
}
})


我正在阅读过滤器的角度文档,但如果您能给我一些过滤器的示例,这将是非常有帮助的。谢谢,这很有意义!
6.  The Risk/Control reference id is seen on the Process Search grids, but when I search by Risk/Control, I don’t see the corresponding control/risk grid having the ref id column however tool tip has it
7.  The label change “Originating Source System Process/Risk/Control ID” is not done in View/Search Inventory tool tips of Process, Risk, Control grids, It has to be fixed for all the 3 searches “By Process/Risk/Control”
2.  Upload Template Header – Risk Causal and Impact comments are color coded as mandatory but they are optional. Similary the Originating Source System Process/Risk/control ID
3.  In the upload template, for any of the multi value fields, I use an invalid delimiter ‘:’, Eg: 13:7 , for some reason this changes the cell format to time format and thereafter I am not able to give any single values, its always converted to time format. Not sure if this is a training issue, but want to put it on the table to see if it requires any fix at all
4.  In Upload, for the grid field length validations, the filter doesn’t works on Row Number and Max Allowed columns. ~!@#$%^&*()_+|}{:"?><,./';[]\=-0987654321`
5.  ERH All levels added in the View End to End ERH screen – Sort and Filter doesn’t works, After clicking on this field, none of the other filter/sort works on the page. Also the sort indicator(black triangle) is not visible, I believe the column width needs to be adjusted.
6.  The Risk/Control reference id is seen on the Process Search grids, but when I search by Risk/Control, I don’t see the corresponding control/risk grid having the ref id column however tool tip has it
7.  The label change “Originating Source System Process/Risk/Control ID” is not done in View/Search Inventory tool tips of Process, Risk, Control grids, It has to be fixed for all the 3 searches “By Process/Risk/Control”
2.  Upload Template Header – Risk Causal and Impact comments are color coded as mandatory but they are optional. Similary the Originating Source System Process/Risk/control ID
3.  In the upload template, for any of the multi value fields, I use an invalid delimiter ‘:’, Eg: 13:7 , for some reason this changes the cell format to time format and thereafter I am not able to give any single values, its always converted to time format. Not sure if this is a training issue, but want to put it on the table to see if it requires any fix at all
4.  In Upload, for the grid field length validations, the filter doesn’t works on Row Number and Max Allowed columns. ~!@#$%^&*()_+|}{:"?><,./';[]\=-0987654321`