AngularJS中如何去掉 ng-repeat的自动排序

2025-03-22 08:54:47
推荐回答(1个)
回答1:

两种方式可以实现 1:使用replace函数替换 var str="hello world!"; str=str.replace("l",""); 即使用空串替换某一个字符串,则是可以实现去除指定字符串功能 2:使用字符串分割函数在聚合 var str="hello world!" var items=str.split("o") 会得到一个数组,数组中包括利用o分割后的多个字符串(不包括o) var newStr=items.join(""); 会得到一个新字符串,将数组中的数组使用空串连接成一个新字符串