eu81273 / angular.treeview

AngularJS based Treeview (no jQuery)
MIT License
405 stars 223 forks source link

Expand tree while clicking on text #61

Open vinayakvinay opened 8 years ago

vinayakvinay commented 8 years ago

Hi there, How do I expand tree nodes while clicking on the text instead of folder icon.

@eu81273

awadhesh22791 commented 8 years ago

Hi, I have solved this issue hope it will be helpful to you. I have update the file angular.treeview.min.js

!function(a){"use strict";a.module("angularTreeview",[]).directive("treeModel",["$compile",function(a){return{restrict:"A",link:function(b,c,d){var e=d.treeId,f=d.treeModel,g=d.nodeId||"id",h=d.nodeLabel||"label",i=d.nodeChildren||"children",j='<ul><li data-ng-repeat="node in '+f+'"><i class="collapsed" data-ng-show="node.'+i+'.length && node.collapsed" data-ng-click="'+e+'.selectNodeHead(node)"></i><i class="expanded" data-ng-show="node.'+i+'.length && !node.collapsed" data-ng-click="'+e+'.selectNodeHead(node)"></i><i class="normal" data-ng-hide="node.'+i+'.length"></i> <span data-ng-class="node.selected" data-ng-click="'+e+".selectNodeLabel(node);"+e+'.selectNodeHead(node)">{{node.'+h+'}}</span><div data-ng-hide="node.collapsed" data-tree-id="'+e+'" data-tree-model="node.'+i+'" data-node-id='+g+" data-node-label="+h+" data-node-children="+i+"></div></li></ul>";e&&f&&(d.angularTreeview&&(b[e]=b[e]||{},b[e].selectNodeHead=b[e].selectNodeHead||function(a){a.collapsed=!a.collapsed},b[e].selectNodeLabel=b[e].selectNodeLabel||function(a){b[e].currentNode&&b[e].currentNode.selected&&(b[e].currentNode.selected=void 0),a.selected="selected",b[e].currentNode=a}),c.html("").append(a(j)(b)))}}}])}(angular);

ibnYusrat commented 7 years ago

Awesome solution man! Thanks.

eviltek2099 commented 7 years ago

could you possibly post th un-min version? I would like to learn from this but I can't find where you made the change.

ibnYusrat commented 7 years ago

@eviltek2099 you can open the code and simply beautify it in atom or any online service.