Created
February 19, 2021 14:53
-
-
Save AnteaterKit/712139d724be2534d9f1c4a8fd352d94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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