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.
Unfortunately, activation email could not send to your email. Please try again.

Angularjs treeview click event

Thread ID:

Created:

Updated:

Platform:

Replies:

129003 Feb 21,2017 03:05 AM Feb 22,2017 04:56 AM JavaScript 2
loading
Tags: ejTreeView
Adrian
Asked On February 21, 2017 03:05 AM

Hi All,

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

Thanks in advance.

Adrian
Replied On February 21, 2017 03:20 AM

I Just discover primitive ng-click will do.

Karthik Ravichandran [Syncfusion]
Replied On February 22, 2017 04:56 AM

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" /> 
 
[controller] 
 
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. 
 
Regards, 
Karthik R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;