按多级Deep Property过滤

时间:2016-12-28 10:19:47

标签: angularjs angularjs-filter

我有一个有点像下面提到的集合: -


    [
        {
        rootGroup: "group1",
        secondGroup: false,
        items: [
                 {name:"Ram"},
                 {name:"Mohan"},
                 {name:"Shyam"},
               ]
        },
        {
        rootGroup: "group2",
        secondGroup: true,
        secondLevelGroups:[
           {
           group: "gp1"
           items: [
                    {name:"Ganesh"},
                    {name:"Sita"},
                    {name:"Gita"},
                  ]
           },
           {
           group: "gp2"
           items: [
                    {name:"Soham"},
                    {name:"Vikas"},
                    {name:"Ashish"},
                  ]
           }
        ]
        }
    ]

现在我想过滤名字。因此,例如,如果过滤器值为" am" ,则输出应如下所示。



    [
        {
        rootGroup: "group1",
        secondGroup: false,
        items: [
                 {name:"Ram"},`
                 {name:"Shyam"},
               ]
        },
        {
        rootGroup: "group2",
        secondGroup: true,
        secondLevelGroups:[
           {
           group: "gp2"
           items: [
                    {name:"Soham"},
                  ]
           }
        ]
        }
    ]

我想使用angularjs过滤器

1 个答案:

答案 0 :(得分:2)

您是否尝试过扩展角度过滤器:https://github.com/a8m/angular-filter