I\'m learning Angular 2, trying to build an expandable tree-view from a (potentially very large) third-party API. The API has an underlying structure like this:
in Angular2 you can render directives recursively. This makes rendering the tree very easy. I've modified your Plunker a little bit just to show the point. It's not the ideal implementation but it works as expected :).
Example:
@Component({
selector: 'tree-view',
template: `
`,
directives: [TreeView]
})
export class TreeView {
@Input()
private dirs: Array;
}
I hope you will like it.
Cheers!
讨论(0)