Skip to content

Instantly share code, notes, and snippets.

@AnteaterKit
Created February 19, 2021 14:53
Show Gist options
  • Save AnteaterKit/712139d724be2534d9f1c4a8fd352d94 to your computer and use it in GitHub Desktop.
Save AnteaterKit/712139d724be2534d9f1c4a8fd352d94 to your computer and use it in GitHub Desktop.
@Component({
selector: 'tree-node-indent',
template: `
<span class='tree-node-indent' *ngFor="let i of list; let index = index"></span>
`,
})
export class TreeNodeIndentComponent implements OnInit, OnChanges {
@Input()
level: number;
list: number[] = [];
constructor() { }
ngOnInit(): void {
}
ngOnChanges(changes: SimpleChanges): void {
const { level } = changes;
if (level) {
this.list = [...new Array(level.currentValue || 0)];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment