{"action":"opened","issue":{"url":"https://api.github.com/repos/iVantage/angular-ivh-treeview/issues/97","labels_url":"https://api.github.com/repos/iVantage/angular-ivh-treeview/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/iVantage/angular-ivh-treeview/issues/97/comments","events_url":"https://api.github.com/repos/iVantage/angular-ivh-treeview/issues/97/events","html_url":"https://github.com/iVantage/angular-ivh-treeview/issues/97","id":118262305,"number":97,"title":"Custom nodes","user":{"login":"martitv","id":7986195,"avatar_url":"https://avatars.githubusercontent.com/u/7986195?v=3","gravatar_id":"","url":"https://api.github.com/users/martitv","html_url":"https://github.com/martitv","followers_url":"https://api.github.com/users/martitv/followers","following_url":"https://api.github.com/users/martitv/following{/other_user}","gists_url":"https://api.github.com/users/martitv/gists{/gist_id}","starred_url":"https://api.github.com/users/martitv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martitv/subscriptions","organizations_url":"https://api.github.com/users/martitv/orgs","repos_url":"https://api.github.com/users/martitv/repos","events_url":"https://api.github.com/users/martitv/events{/privacy}","received_events_url":"https://api.github.com/users/martitv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-22T12:54:28Z","updated_at":"2015-11-22T12:54:28Z","closed_at":null,"body":"Hi, trying to create a directive that lets me select nodes by clicking the label.\r\nCurrently it is not working so well due to the scope i get in the directive is not the scope i want.\r\n\r\nThis is my directive(tried to follow your example):\r\n```javascript\r\n.directive('labelSelect', ['ivhTreeviewMgr', function(ivhTreeviewMgr){\r\n        return {\r\n            restrict: 'A',\r\n            template: '',\r\n            link: function($scope, $elm, $attrs){\r\n                $elm.on('click', function(){\r\n                    ivhTreeviewMgr.select($scope.tree_content, $scope.node, !$scope.node.selected);\r\n                    $elm.toggleClass('node-selected', !$scope.node.selected);\r\n                    $scope.$apply();\r\n                })\r\n            }\r\n        }\r\n    }]);\r\n```\r\n\r\nController:\r\n```javascript\r\nangular.module('myApp.thing', [])\r\n.controller('ctrl', function(){\r\n$scope.tree_content = [\r\n            {\r\n            label: 'Hats',\r\n            children: [\r\n                {label: 'Flat cap'},\r\n                {label: 'Fedora'},\r\n                {label: 'Baseball', selected: true},\r\n                {label: 'Top hat'},\r\n                {label: 'Gatsby'}\r\n            ]\r\n        },{\r\n            label: 'Pens',\r\n            selected: true,\r\n            children: [\r\n                {label: 'Fountain'},\r\n                {label: 'Gel ink'},\r\n                {label: 'Roller ball'},\r\n                {label: 'Fiber tip'},\r\n                {label: 'Ballpoint'}\r\n            ]\r\n        },{\r\n            label: 'Whiskey',\r\n            children: [\r\n                {label: 'Irish'},\r\n                {label: 'Scotch'},\r\n                {label: 'Rye'},\r\n                {label: 'Tennessee'},\r\n                {label: 'Bourbon'}\r\n            ]\r\n        }];\r\n\r\n        $scope.tree_options = {\r\n            twistieCollapsedTpl: '<span class=\"glyphicon glyphicon-chevron-right\"></span>',\r\n            twistieExpandedTpl: '<span class=\"glyphicon glyphicon-chevron-down\"></span>',\r\n            twistieLeafTpl: '&#9679;',\r\n            nodeTpl: [\r\n                '<div>',\r\n                '<span ivh-treeview-toggle>',\r\n                '<span ivh-treeview-twistie></span>',\r\n                '</span>',\r\n                '<span class=\"ivh-treeview-node-label\" label-select ivh-treeview-toggle>',\r\n                '{{trvw.label(node)}}',\r\n                '</span>',\r\n                '<div ivh-treeview-children></div>',\r\n                '</div>'\r\n            ].join('\\n')\r\n        }\r\n});\r\n```\r\nHTML:\r\n```html\r\n<div ivh-treeview=\"tree_content\"\r\n                ivh-treeview-options=\"tree_options\"\r\n                ivh-treeview-use-checkbox=\"false\"></div>\r\n```\r\n\r\nWhen i try to click the labels i get node.children is undefined from the bfs function. Probably because $scope.tree_content is undefine.\r\n\r\nHow can i get my controllers scope into the directive? or how can i let the directive see the tree_content?\r\n\r\nThanks."}}