1

I want to create table (not use ul li) as below

-----------------
#   |  name      |
-----------------
1   | Level_1-a  |
1   | Level_2.1  |
2   | Level_2.2  |
3   | Level_2.3  |
1   | Level_2.3.1|
2   | Level_2.3.2|
2   | Level_1-b  |
..  | Level_..   |
n   | Level_n    | 
..................

With items $scope.items = [{ name: "level_1", child: { name: "level_2", child: { name: "level_3", child: { name: "level_...", child: { name : "level_n", child : { ....} } } } } }];

I dont have idea to do it. So please help me.

Thank all.

4
  • Can you explain what # is and what name is. I don't really get it because your table doesn't match up with your json. Commented Jan 28, 2015 at 10:28
  • Sorry my mistake, I fixed it. Do you understand my question? Commented Jan 28, 2015 at 14:29
  • Why does level 2 have # as 1 and level 3 as # as 2? Commented Jan 29, 2015 at 5:26
  • stackoverflow.com/questions/27071726/… Commented Apr 1, 2015 at 3:10

1 Answer 1

0

If possible, I would reformat the JSON. Doing so, you could do a simple ng-repeat in a table. Much cleaner code. If you do not reformat the JSON, I think you will need to do a ng-repeat at each level.

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

1 Comment

Because level 2 is child of level 1, level 3 is child of level 2 so how to format Json?

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.