0

I'm building my first angularjs app, and still struggling with the scopes and stuff.

I'm trying to build a multi level tree, where I can edit nodes to become sub-nodes, or get them one level up (from sub node to parent), but I'm kind of stuck.

So far, I managed to set a root node as a sub-node. But set a sub-node as a root node is a whole different story, because I have to access the parent node, which right now I don't know how to do.

Plnkr

Any idea of how I can change a sub-node to a root node? Thanks

Edit:

Imagine this tree:

  • Item 1
    • Sub Item 1.1 [button 1]
    • Sub Item 1.2 [button 2]
  • Item 2
  • Item 3
  • Item 4

You click the [button 2] and you got this:

  • Item 1
    • Sub Item 1.1
  • Sub Item 1.2
  • Item 2
  • Item 3
  • Item 4

2 Answers 2

0

Finally I has able to figure it out.

Sure, the code looks ugly as hell, but with my limited knowledge of angularjs, that's what I could do. It is not pretty, but does exactly what I want.

Every item could be set as a sub item, with sub items, and them turn them again into root items.

Plunker

Sign up to request clarification or add additional context in comments.

Comments

0

this one is dynamic and drag drop tree.

http://www.jqueryrain.com/?KIVkhqxl

it supports:

  1. Inputs
  2. Custom Templates
  3. Action Mapping
  4. Events
  5. Async Data
  6. Filtering
  7. Drag & Drop

Features:

  1. Dynamically changing the tree
  2. API
  3. Styling
  4. Tri-State Checkboxes
  5. Large Trees & Virtual Scroll
  6. Redux / Immutable Data

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.