ng2-tree
ng2-tree copied to clipboard
Root Element did not have Treecontroller
Because the Root element Did not have Treecontroller, It is not possible to select it by using "getControllerByNodeId(
in debugger: (File: tree.service.js)
1. TreeService.prototype.getController = function (id) {
2. if (this.controllers.has(id)) {
3. return this.controllers.get(id);
4. }
5. return null;
6. };
dump of "this.controller" (Line2) indicate a list of all nodes in tree with a Treecontroller except the root node!!!
@badframe I noticed the same thing. I use a workaround by getting to the root controller via:
TreeComponent.rootComponent.controller
A bit hacky, but it works. It would be better, of course, if we could get to the root controller using the same function as other nodes.
@badframe @dpollastrini Are you sure you actually have an id assigned to the root node?
@rychcog Yes. Value was 0.
@dpollastrini I'll try this value (zero). But I wasn't able to reproduce. Could you try another id (some string value for example)?
Don't use "getControllerByNodeId()", use "getController()"