{"_id":"5a2a43a00b68c20026c6c423","category":{"_id":"5a2a43a00b68c20026c6c420","version":"5a2a43a00b68c20026c6c41d","project":"5707c6875309d117006948d4","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-07-15T07:29:53.852Z","from_sync":false,"order":2,"slug":"api","title":"API"},"project":"5707c6875309d117006948d4","user":"54d742a80771980d0052f4b5","parentDoc":null,"version":{"_id":"5a2a43a00b68c20026c6c41d","project":"5707c6875309d117006948d4","__v":1,"createdAt":"2017-12-08T07:47:44.113Z","releaseDate":"2017-12-08T07:47:44.113Z","categories":["5a2a43a00b68c20026c6c41e","5a2a43a00b68c20026c6c41f","5a2a43a00b68c20026c6c420","5a2a43a00b68c20026c6c421"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"6.1.0","version":"6.1.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-07-15T07:30:23.097Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":18,"body":"[block:api-header]\n{\n  \"title\": \"How to invoke methods\"\n}\n[/block]\nGet a reference to the `treeModel` attribute to access the API.\nFor example:\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</button>\\n  <button (click)=\\\"tree.treeModel.focusPreviousNode()\\\">Prev</button>\\n\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nOr using a `ViewChild`:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import { TreeComponent, TreeModel, TreeNode } from 'angular-tree-component';\\n\\nclass MyComponent {\\n  :::at:::ViewChild('tree') treeComponent: TreeComponent;\\n\\n  ngAfterInit() {\\n    const treeModel:TreeModel = this.treeComponent.treeModel;\\n    const firstNode:TreeNode = treeModel.getFirstRoot();\\n    \\n    firstNode.setActiveAndVisible();\\n  }\\n}\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Complete API\"\n}\n[/block]\nYou can find the complete API of the TreeModel here:\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://rawgit.com/500tech/angular-tree-component/master/doc/interfaces/_api_.itreemodel.html\",\n  \"title\": \"ITreeModel | angular-tree-component\",\n  \"favicon\": \"https://rawgit.com/favicon.ico\",\n  \"iframe\": true,\n  \"height\": \"2000px\"\n}\n[/block]","excerpt":"","slug":"treemodel","type":"basic","title":"TreeModel"}
[block:api-header] { "title": "How to invoke methods" } [/block] Get a reference to the `treeModel` attribute to access the API. For example: [block:code] { "codes": [ { "code": "\t<tree-root #tree [nodes]=\"nodes\"></tree-root>\n\n <button (click)=\"tree.treeModel.focusNextNode()\">Next</button>\n <button (click)=\"tree.treeModel.focusPreviousNode()\">Prev</button>\n", "language": "html" } ] } [/block] Or using a `ViewChild`: [block:code] { "codes": [ { "code": "import { TreeComponent, TreeModel, TreeNode } from 'angular-tree-component';\n\nclass MyComponent {\n @ViewChild('tree') treeComponent: TreeComponent;\n\n ngAfterInit() {\n const treeModel:TreeModel = this.treeComponent.treeModel;\n const firstNode:TreeNode = treeModel.getFirstRoot();\n \n firstNode.setActiveAndVisible();\n }\n}", "language": "javascript" } ] } [/block] [block:api-header] { "title": "Complete API" } [/block] You can find the complete API of the TreeModel here: [block:embed] { "html": false, "url": "https://rawgit.com/500tech/angular-tree-component/master/doc/interfaces/_api_.itreemodel.html", "title": "ITreeModel | angular-tree-component", "favicon": "https://rawgit.com/favicon.ico", "iframe": true, "height": "2000px" } [/block]