{"_id":"5aff027686c0a90003b9239e","category":{"_id":"5aff027686c0a90003b923b1","version":"5aff027686c0a90003b923b4","project":"5707c6875309d117006948d4","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-07-15T07:28:09.870Z","from_sync":false,"order":0,"slug":"getting-started","title":"Basic"},"project":"5707c6875309d117006948d4","user":"54d742a80771980d0052f4b5","parentDoc":null,"version":{"_id":"5aff027686c0a90003b923b4","project":"5707c6875309d117006948d4","__v":0,"forked_from":"5ab4fbd96316b00012bd8970","createdAt":"2018-03-23T13:06:33.352Z","releaseDate":"2018-03-23T13:06:33.352Z","categories":["5aff027686c0a90003b923b1","5aff027686c0a90003b923b2","5aff027686c0a90003b923b3"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"7.2.0","version":"7.2.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-07-15T07:33:00.256Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":7,"body":"You can access the tree API by using the `treeModel` attribute on the element:\n[block:api-header]\n{\n  \"title\": \"Demo\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<iframe src=\\\"https://rawgit.com/500tech/angular-tree-component/master/example/cli/dist/#/api\\\" width=\\\"100%\\\" height=\\\"400px\\\"></iframe>\\n\"\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<a href=\\\"https://github.com/500tech/angular-tree-component/blob/master/example/cli/src/app/api/api.component.ts\\\" target=\\\"_blank\\\">Source code for this demo</a>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\t<tree-root #tree [nodes]=\\\"nodes\\\"></tree-root>\\n\\n  <button (click)=\\\"tree.treeModel.focusNextNode()\\\">next node</button>\\n  <button (click)=\\\"tree.treeModel.focusPreviousNode()\\\">previous node</button>\\n  <button (click)=\\\"tree.treeModel.focusDrillDown()\\\">drill down</button>\\n  <button (click)=\\\"tree.treeModel.focusDrillUp()\\\">drill up</button>\\n\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nOr by accessing the treeNode that is passed through [Events](doc:events) or using [Action Mapping](doc:action-mapping).\n\nYou can find the complete API for TreeModel here:\n[TreeModel](doc:treemodel) \n\nAnd the complete API for TreeNode here:\n[TreeNode](doc:api)","excerpt":"","slug":"calling-methods-on-the-tree","type":"basic","title":"Calling API Methods"}

Calling API Methods


You can access the tree API by using the `treeModel` attribute on the element: [block:api-header] { "title": "Demo" } [/block] [block:html] { "html": "<iframe src=\"https://rawgit.com/500tech/angular-tree-component/master/example/cli/dist/#/api\" width=\"100%\" height=\"400px\"></iframe>\n" } [/block] [block:html] { "html": "<a href=\"https://github.com/500tech/angular-tree-component/blob/master/example/cli/src/app/api/api.component.ts\" target=\"_blank\">Source code for this demo</a>" } [/block] [block:code] { "codes": [ { "code": "\t<tree-root #tree [nodes]=\"nodes\"></tree-root>\n\n <button (click)=\"tree.treeModel.focusNextNode()\">next node</button>\n <button (click)=\"tree.treeModel.focusPreviousNode()\">previous node</button>\n <button (click)=\"tree.treeModel.focusDrillDown()\">drill down</button>\n <button (click)=\"tree.treeModel.focusDrillUp()\">drill up</button>\n", "language": "html" } ] } [/block] Or by accessing the treeNode that is passed through [Events](doc:events) or using [Action Mapping](doc:action-mapping). You can find the complete API for TreeModel here: [TreeModel](doc:treemodel) And the complete API for TreeNode here: [TreeNode](doc:api)