I am faced with a complex nested structure like the following example:
let structure = [{
section: '1',
title: 'First level title',
children: [{
section: '1.1',
title: 'Second level title',
children: []
}, {
section: '1.2',
title: 'Second level title',
children: [{
section: '1.2.1',
title: 'Third level title',
children: []
}, {
section: '1.2.2',
title: 'Third level title',
children: []
}]
}, {
section: '1.3',
title: 'Second level title',
children: []
}]
}, {
section: '2',
title: 'First level title',
children: [{
section: '2.1',
title: 'Second level title',
children: []
}, {
section: '2.2',
title: 'Second level title',
children: []
}]
}, ...other objects]
The structure resembles a table of contents, where each object represents a unit with its own section number, title, and sub-section array.
The challenge lies in not knowing the exact number of sections or levels of nesting within this data. With potentially over 2000 objects of varying configurations, it's important to find the most efficient way to represent this structure on an HTML page. While considering using ng-repeat for this task, the uncertainty regarding the depth of nested levels poses a question on its feasibility. Additionally, adjusting section numbers after removing a specific section introduces another layer of complexity when handling such a large dataset.