Angularjs 1 groupBy部分匹配字符串
我有一个JSON对象,我想通过部分匹配对项目进行分组Angularjs 1 groupBy部分匹配字符串,angularjs,Angularjs,我有一个JSON对象,我想通过部分匹配对项目进行分组 var object = [ {id: 1, items: "a, b, c, d"}, {id: 2, items: "a, b, d, c"}, {id: 3, items: "a, b, c, d, e"} {id: 4, items: "a, b, d, c, e"} ]; 我想知道当我做每句话时,这个粗略的例子是否可行: <li ng-repeat="(key, value) in obje
var object = [
{id: 1, items: "a, b, c, d"},
{id: 2, items: "a, b, d, c"},
{id: 3, items: "a, b, c, d, e"}
{id: 4, items: "a, b, d, c, e"}
];
我想知道当我做每句话时,这个粗略的例子是否可行:
<li ng-repeat="(key, value) in object | groupBy: 'items' track by $index">
{{value.length}}
</li>
{{value.length}
我希望输出为2xa、b、c、d和2xa、b、c、d、e,但默认情况下,groupBy函数仅在字符串100%匹配时对项目进行分组,因此我将得到4个不同的组