Teach the Angular tree component to re-render itself when its underyling
tree has been replaced.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
})
export class TreeComponent implements OnInit {
- @Input() tree: Tree;
+ _tree: Tree;
+ @Input() set tree(t: Tree) {
+ if (t) {
+ this._tree = t;
+ this._tree.nodeList(); // reindex nodes
+ }
+ }
+
+ get tree(): Tree {
+ return this._tree;
+ }
+
@Output() nodeClicked: EventEmitter<TreeNode>;
constructor() {