去掉尾部的符号
html:
<td class="td_limit">{[item.group | myfilter]}</td>
js:
myBaseApp.filter('myfilter', function() {return function(value) {if (!value) { return; } //加了这一句是为了防止报错 Cannot read property 'slice' of undefinedreturn value =value.slice(0,value.length-1)} });
效果:hello world ! ==>hello world
如果觉得《自定义angular 过滤器 之 去掉字符串尾部的符号》对你有帮助,请点赞、收藏,并留下你的观点哦!