angular-tree-component
angular-tree-component copied to clipboard
not able to close loading on click of node arrow(getChildren) in case of an error from server or not data response from server
the get children function
getChildren(node:TreeNode) { return new Promise((resolve, reject) => { this.yourService.getChildren(node.data).subscribe(data => { resolve(data ); }, error => this.onLoadFailed(error)); }); }
Please explain what to do in this.onLoadFailed(error) function
What we in our project currently do is adding an error node to the tree. This way our getChildren always returns something. The user can than click that node again and it will reload the failed request. At first this felt a bit like a weird workaround, but it's working quite nice from an ux perspective in our project. But we will need to fix this and introduce better error handling in the angular-tree-component.