Click here to Skip to main content
15,901,373 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm trying to implement a search on a nested list. The idea is that when a search is performed on the list both the parents and children of the found element are visible.

Right now I have a list and I'm able to search for a element and return the all the parents for the element.

But I'm not able to show the children of all the elements that are visible.

Here is fiddle that filters and shows the parents of all elements that are found. plunker with the list and search--Plunker[^]

I added a piece of code that adds show property to every child of a visible parent but only if the children has few more children.

JavaScript
function setChildren(child) {
    var i;
    if (child) {
        for (i=0;i< child.length;i++){
            child[i].show = true;
            setChildren(child[i].children);
        }
    }
}

attempt to show children--Plunker[^]

Any thoughts on how this can be achieved?
Posted

1 solution

angularjs Access parent scope from child controller - Stack Overflow[^]


the more the in child the more $parent is add $parent.$parent
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900