Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Example of multidimensional (3 or deeper) #3

Open

Description

@rosslavery

Having a hard time figuring out the expected syntax when you get more than 2 levels deep as shown in the example.

I tried something to the effect of:

<ul ng-tree="clients">
    <li each="account in accounts">
        {{account.name}}
        <ul ng-tree="account">
            <li each="party in account.parties">{{party.name}}</li>
        </ul>
    </li>
</ul>

with no luck... I've also tried:

<ul ng-tree="clients">
    <li each="account in accounts">
        {{account.name}}
        <ul>
            <li each="party in account.parties">{{party.name}}</li>
        </ul>
    </li>
</ul>

Any help would be appreciated. Thank you!

Activity

  1. dump247 commented on Mar 25, 2013

    @dump247
    Owner

    Nested trees are something that should work, but I have not tested that scenario so it may not work as expected. Note that the selection handling would be independent for each tree in that case.

    In angular.tree, there is only one template, so you need to make that template handle different node types. Something like this:

    <ul ng-tree="clients">
        <li each="item in children()">{{item.name}}</li>
    </ul>
    

    Then you would need to define a function on your client, account, and party that returned that node's children list. Unfortunately, at this point, there is not a mechanism to define a function on the scope to return the children list. You can use ngSwitch, ngInclude, etc to customize the node view based on the type of node being rendered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions