Ayush Kumar
Ayush Kumar

Reputation: 37

Filter by multilevel Deep Property

I have a collection somewhat like mentioned below:-


    [
        {
        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"},
                  ]
           }
        ]
        }
    ]

Now I want to filter on name. So for example if the filter value is "am" then the output should be like as below.



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

I want to do it using angularjs filter

Upvotes: 0

Views: 346

Answers (1)

Donniewiko
Donniewiko

Reputation: 1683

Have you tried the extension angular filter: https://github.com/a8m/angular-filter

Upvotes: 2

Related Questions