We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Angularjs treeview click event

Hi All,

How can I implement a click event in angularjs tree view? any example would be a huge help.

Thanks in advance.

2 Replies

AD Adrian February 21, 2017 08:20 AM UTC

I Just discover primitive ng-click will do.

KR Karthik Ravichandran Syncfusion Team February 22, 2017 09:56 AM UTC

Hi Adrian, 
Thanks for contacting Syncfusion support. 
We have analyzed your query (“How can I implement a click event in angularjs tree view?”). We would like to inform you that, you can achieve your requirement using “nodeClick” event of ejTreeView 
Please refer the below code block. 
<div id="treeView" ej-treeview e-fields-datasource="dataList" e-fields-id="id" e-fields-parentid="pid" e-fields-text="name" e-fields-haschild="hasChild" e-fields-expanded="expanded" e-nodeclick="onClick" /> 
angular.module('syncApp', ['ejangular']) 
    .controller('TreeViewCtrl', function ($scope) { 
        $scope.dataList = phones; 
        $scope.onClick = function (args) { 
            if ($(args.currentElement).hasClass('e-text')) { 
                $scope.selectedvalue = args.currentElement.innerText; 
For your convenience, we have prepared the sample, please refer the below link 
To know more details about the nodeClick event in ejTreeView, please refer the below documentation link. 
Please let us know if you need further assistance on this. 
Karthik R 

Live Chat Icon For mobile
Up arrow icon