Click here to Skip to main content
15,902,492 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
<html>
|<head>
<link rel="stylesheet" type="text/css" href="ajs.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script>

jabascript
var myApp = angular.module('myApp', ['angularTreeview']);
myApp.controller('myController', function($scope){
//Tree model 1
$scope.roleList1 = [
	{ "roleName" : "User", "roleId" : "role1", "children" : [
	{ "roleName" : "subUser1", "roleId" : "role11", "children" : [] },
        { "roleName" : "subUser2", "roleId" : "role12", "children" : [
	{ "roleName" : "subUser2-1", "roleId" : "role121", "children" : [
        { "roleName" : "subUser2-1-1", "roleId" : "role1211", "children" : [] },
	{ "roleName" : "subUser2-1-2", "roleId" : "role1212", "children" : [] }
      ]}
    ]}
]},
   { "roleName" : "Admin", "roleId" : "role2", "children" : [] },
   { "roleName" : "Guest", "roleId" : "role3", "children" : [] }
];
   //roleList1 to treeview
   $scope.roleList = $scope.roleList1;
  });
  (function(f) {
    f.module("angularTreeview", []).directive("treeModel", function($compile) {
        return {
            restrict: "A",
            link: function(b, h, c) {
                var a = c.treeId,
                    g = c.treeModel,
                    e = c.nodeLabel || "label",
                    d = c.nodeChildren || "children",
                    e = '<ul><li data-ng-repeat="node in ' + g + '">
^__i class="normal" data-ng-hide="node.' +<br mode=" hold=" />                    d + '.length"> <span data-ng-class="node.selected" data-ng-click="' + a + '.selectNodeLabel(node)">{{node.' + e + '}}</span><div data-ng-hide="node.collapsed" data-tree-id="' + a + '" data-tree-model="node.' + d + '" data-node-id=" + (c.nodeId || "id") + " data-node-label=" + e + " data-node-children=" + d + "></div></li></ul>";<br mode="hold" />                a && g && (c.angularTreeview && (b[a] = b[a] || {}, b[a].selectNodeHead = b[a].selectNodeHead || function(a) {<br mode="hold" />                    a.collapsed = !a.collapsed<br mode="hold" />                }, b[a].selectNodeLabel = b[a].selectNodeLabel || function(c) {<br mode="hold" />                    b[a].currentNode && b[a].currentNode.selected &&<br mode="hold" />                        (b[a].currentNode.selected = void 0);<br mode="hold" />                    c.selected = "selected";<br mode="hold" />                    b[a].currentNode = c<br mode="hold" />                }), h.html("></div></li></ul>
Posted
Updated 7-Sep-15 22:15pm
v2
Comments
Andy Lanng 8-Sep-15 4:18am    
Please do not code dump. You will not get any interest is your question like that.
The subject box is where you summarize the question. The body of the question should be where you expand on that and state, with code examples where appropriate:
1: What you goal is
2: What you have tried
3: Why / How it does not work.

Please use the "Improve Question" button above this comment to expand on your request.

Thanks ^_^
Andy

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900