Skip to content

cvishalgit/tree-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Assignment

Display a Hierarchical Tree Structure in Angular

🎯 Objective

Build an Angular component that takes a tree-like data structure (key β†’ children array) and displays it as a properly indented hierarchy using nested <ul> and <li> lists.


πŸ“‹ Input Data

The component should work with the following tree object:

const tree = {
  "a": ["b", "c"],
  "b": ["d", "e"],
  "c": ["f", "g"],
  "e": ["h", "i"],
  "f": ["j", "k"]
};
πŸ“Œ Expected Output

The tree should be rendered as:
a
- b
    - d
    - e
        - h
        - i
- c
    - f
        - j
        - k
    - g
πŸš€ How to Run

Clone this repository:

git clone https://github.com/cvishalgit/tree-assignment.git


Navigate into the project:

cd tree-assignment


Install dependencies:

npm install


Run the Angular development server:

ng serve


Open your browser and go to:

http://localhost:4200

πŸ“‚ Project Structure
tree-assignment/
β”‚-- src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ app.component.ts
β”‚   β”‚   β”œβ”€β”€ app.component.html
β”‚   β”‚   β”œβ”€β”€ app.component.css
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ index.html
β”‚   └── styles.css
β”œβ”€β”€ angular.json
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── README.md

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published