I have an array of objects with the following structure:
[{
"name": "Equipment",
"functional_id": "furniture",
"products": [
{
"file": "data:image/;base64,",
"name": "White bags",
"description": "Reusable",
"id": 11,
"path": "",
"items": [
{
"name": "Small model",
"description": "25",
"price": 0,
"functional_id": "white_bags_small_model_by_25"
},
{
"name": "Medium model",
"description": "20",
"price": 0,
"functional_id": "white_bags_medium_model_by_20"
},
{
"name": "Large model",
"description": "10",
"price": 0,
"functional_id": "white_bags_large_model_by_10"
}
]
},
{
"file": "data:image/;base64,",
"name": "Burgundy bags",
"description": "Reusable",
"id": 12,
"path": "",
"items": [
{
"name": "Small model",
"description": "25",
"price": 0,
"functional_id": "bags_burgundy_bags_small_model_by_10"
},
{
"name": "Large model",
"description": "Par 10",
"price": 0,
"functional_id": "bags_burgundy_bags_large_model_by_10"
}
]
}
],
"sorting": 2300"
},
{
"name": "Documents",
"functional_id": "docs",
"products": [
{
"file": "data:image/;base64,",
"name": "Book of conventions",
"id": 17,
"path": "",
"items": [
{
"price": 0,
"functional_id": "agreement_book"
}
]
},
{
"file": "data:image/;base64,",
"name": "Procedure posters",
"description": "Procedure",
"id": 18,
"path": "",
"items": [
{
"price": 0,
"functional_id": "posters_procedure_of_taking_in_charge"
}
]
},
{
"file": "data:image/;base64,",
"name": "Services Brochures",
"description": "Brochures",
"id": 19,
"path": "",
"items": [
{
"price": 0,
"functional_id": "services_brochures"
}
]
},
{
"file": "data:image/;base64,",
"name": "Catalogue",
"id": 20,
"path": "",
"items": [
{
"price": 0,
"functional_id": "catalogue"
}
]
}
],
"sorting": 2400
},
{
"name": "Products",
"functional_id": "prods",
"products": [
{
"file": "data:image/;base64,",
"name": "Articles",
"id": 19,
"path": "",
"items": [
{
"price": 0,
"functional_id": "book_1"
}
]
},
{
"file": "data:image/;base64,",
"name": "Procedure_b",
"description": "Procedure",
"id": 24,
"path": "",
"items": [
{
"price": 0,
"functional_id": "book_charge"
}
]
},
{
"file": "data:image/;base64,",
"name": "Book Services",
"description": "Book Services",
"id": 26,
"path": "",
"items": [
{
"price": 0,
"functional_id": "book_services"
}
]
},
{
"file": "data:image/;base64,",
"name": "Catalogue",
"id": 32,
"path": "",
"items": [
{
"price": 0,
"functional_id": "catalogue"
}
]
}
],
"sorting": 4400
}
]
and I represent it in my application with the following html:
<div class='col-lg-12' *ngIf="this.market && this.market.length>0 ">
<ng-container *ngFor='let category of this.market | orderBy:"sorting"'>
<h2>{{category.name}}</h2>
<table class='table table-bordered bg-white'>
<thead class='bg-quinary d-xl-table-row d-none'>
<th>Produits</th>
<th>Description</th>
<th>Prix HT</th>
<th>Quantités</th>
</thead>
<tbody>
<tr *ngFor='let product of category.products | orderBy:"id"' class=" ">
<td>
<div class="d-flex">
<div *ngIf="product && product.path " style="width: 150px">
<img class="img-fluid" src="{{product.file}}" alt="" width="150px">
</div>
<div style="flex: 5" class="p-2">
<h2 class="p-1">{{product.name}}</h2>
<p [innerHTML]="product.description" class="text-muted" *ngIf=" product && product.description"></p>
</div>
</div>
</td>
<td class="p-0 d-xl-table-cell d-none">
<ul class="p-0 m-0">
<li *ngFor='let item of product.items'>
<div style="line-height: 24px" class="">
<p>{{item.name}}</p>
<p class="text-muted">{{item.description}}</p>
</div>
</li>
</ul>
</td>
<td class="p-0 d-xl-table-cell d-none">
<ul class="p-0 m-0">
<li *ngFor='let item of product.items'>
<span>{{item.price || '-'}} €</span>
</li>
</ul>
</td>
<td class="p-0 d-xl-table-cell d-none">
<ul class="p-0 m-0">
<li *ngFor='let item of product.items'>
<input type="number" [(ngModel)]="item.quantity" (change)="this.updateCart(item)" style="height: 45px; line-height: 45px" min="0">
</li>
</ul>
</td>
<td class="p-0 d-table-cell d-xl-none w-100">
<ul class="font">
<li *ngFor='let item of product.items' class=" p-3 item">
<div class="d-flex flex-column w-25 align-self-center">
<p>{{item.name}}</p>
<p class="text-muted">{{item.description}}</p>
</div>
<span class="d-flex flex-column w-25 align-self-center">{{item.price || '-'}} €</span>
<input class="d-flex flex-column w-25 align-self-center" type="number" [(ngModel)]="item.quantity" (change)="this.updateCart(item, product.id)" style="height: 45px" min="0" >
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</ng-container>
</div>
Since the list of the different types of products is very wide (I have simplified the array of objects), a very large scroll is generated.
I am trying to create, following the same list style, a system of tabs through which to load the different types of products according to the tab you select.
To do this I am trying to use the following bootstrap component
<div class='col-lg-12' *ngIf="this.market && this.market.length>0 ">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" style="background-color: #0e5fa4;" id="nav-home-tab" data-toggle="tab" href="#nav-home" role="tab" aria-controls="nav-home" aria-selected="true"><p style="font-weight: bold; font-size: 15px; color: white; padding: 0;">Equipment</p></a>
<a class="nav-item nav-link" style="background-color: white; border: 0.5px solid #0e5fa4;" id="nav-profile-tab" data-toggle="tab" href="#nav-profile" role="tab" aria-controls="nav-profile" aria-selected="false">Documents</a>
<a class="nav-item nav-link" style="background-color: white; border: 0.5px solid #0e5fa4;" id="nav-contact-tab" data-toggle="tab" href="#nav-contact" role="tab" aria-controls="nav-contact" aria-selected="false">Products</a>
</div>
</nav>
In this way, the only thing I have managed to do is to show the different types of products in the different tabs in a static way, but I cannot make the dynamic navigation between them.
If someone sees what I'm doing wrong.
A greeting and thank you in advance
Here is a barebones implementation of dynamic tabs in Angular, with a list of items in each tab. Demo up on Stackblitz.
Template:
<!-- Tab Buttons -->
<ul class="tabs">
<li *ngFor="let tab of tabs; let i = index">
<button (click)="selectedTab = i" [ngStyle]="selectedTab === i && {'background':'blue', 'color':'white'}">{{tab.label}}</button>
</li>
</ul>
<!-- Tab Content -->
<div>
<h3>{{tabs[selectedTab].label}}</h3>
<ul>
<li *ngFor="let item of tabs[selectedTab].items">{{item}}</li>
</ul>
</div>
Component:
tabs = [
{
label: 'Products',
items: ['Ball', 'Car', 'Bricks']
},
{
label: 'People',
items: ['Alice', 'Bob', 'Chris']
}, {
label: 'Animals',
items: ['Dog', 'Cat', 'Mouse']
}
];
selectedTab = 0;
tabs in the component represents an array of the objects you want to present with tabs. This is far simpler than the data structure you've posted, but the principles are the same.
Related
I am trying to create HTML table with dynamic tr and td.
I have added nested loops in the HTML itself , dynamic column headers(th) are working fine but values are not getting added in correct td.
Here is a data I have :
"finalResult": [
{
"tableNamee": "Table_1",
"colCategories": [
{
"columnnnn": "User",
"values": [
{
"value": "0"
},
{
"value": "10"
},
{
"value": "60"
},
{
"value": "0"
},
{
"value": "0"
},
{
"value": "0"
},
{
"value": "0"
},
{
"value": "0"
},
{
"value": "0"
}
]
},
{
"columnnnn": "Header1",
"values": [
{
"value": "460"
}
]
},
{
"columnnnn": "Amount",
"values": [
{
"value": "10"
},
{
"value": "100"
},
{
"value": "50"
}
]
}
]
},
{
"tableNamee": "Table_2",
"colCategories": [
{
"columnnnn": "User",
"values": [
{
"value": "07"
},
{
"value": "10"
}
]
},
{
"columnnnn": "Amount",
"values": [
{
"value": "70"
}
]
},
{
"columnnnn": "User1",
"values": [
{
"value": "57"
}
]
},
{
"columnnnn": "Column",
"values": [
{
"value": "80"
}
]
},
{
"columnnnn": "Column2",
"values": [
{
"value": "10"
}
]
}
]
}
]
And below is the html code for it :
<div *ngFor="let j of finalResult; index as i" class="">
<div class=""> <span title="{{j.tableNamee}}">Table Name : {{j.tableNamee}} </span>
</div>
<div class="">
<table class="table table-bordered">
<tbody>
<tr class="">
<th class="" scope="col" *ngFor="let k of j.colCategories">
{{k.columnnnn}}
</th>
</tr>
<ng-container *ngFor="let k of j.colCategories">
<tr class="">
<ng-container>
<div *ngFor="let m of k.values">
<td class="">
<div class=""> <span title="{{m.value}}"> {{m.value}} </span>
</div>
</td>
</div>
</ng-container>
</tr>
</ng-container>
</tbody>
</table>
</div>
</div>
There is no any specific ts code for this. I just manipulated data in above format and trying to apply loops in HTML itself. Am I doing anything wrong?
this is desired output :
desired output
and this is current output I am getting :
current output
Any help would be appreciated!
Your HTML markup looks weird in that your <tr> contains a <div> which wraps the <td>s. And I think that is what's causing your problem.
I have not tried this but may you can try changing your <table> markup to this:
<table class="table table-bordered">
<thead>
<tr class="">
<th class="" scope="col" *ngFor="let k of j.colCategories">
{{k.columnnnn}}
</th>
</tr>
</thead>
<tbody>
<tr class="" *ngFor="let k of j.colCategories">
<td class="" *ngFor="let m of k.values">
<div class="">
<span title="{{m.value}}"> {{m.value}} </span>
</div>
</td>
</tr>
</tbody>
</table>
guys here's what I'm trying to do.
I want to create a vertical menu with submenus on it.
using this JSON code:
"response": {
"data": [
{
"id": 1,
"name": "AC Articles",
"subname": {
"data": [
{
"id": 14,
"sub_category": "Window PC"
},
{
"id": 15,
"sub_category": "Mac PC"
}
]
}
},
{
"id": 2,
"name": "MyPage Articles",
"subname": {
"data": []
}
},
{
"id": 3,
"name": "PC/Internet Optimization",
"subname": {
"data": []
}
},
{
"id": 4,
"name": "Troubleshooting Guide",
"subname": {
"data": []
}
},
{
"id": 5,
"name": "Others",
"subname": {
"data": []
}
},
{
"id": 6,
"name": "Previous Announcements",
"subname": {
"data": []
}
},
{
"id": 7,
"name": "Operational Update",
"subname": {
"data": []
}
},
{
"id": 8,
"name": "LS Updates",
"subname": {
"data": []
}
},
{
"id": 9,
"name": "Fees Articles",
"subname": {
"data": []
}
},
{
"id": 10,
"name": "Teacher's Promotion Guide",
"subname": {
"data": []
}
},
{
"id": 11,
"name": "Modified Mypage Unlocking Process",
"subname": {
"data": []
}
},
{
"id": 12,
"name": "Training Specialization",
"subname": {
"data": []
}
},
{
"id": 13,
"name": "PHBee TESOL Common Concerns/Inquiries",
"subname": {
"data": []
}
}
]
}
so far here's what i have done
<ul class="nav flex-column">
<li
v-for="list in categories"
:key="list.id"
class="nav-item dropdown"
>
<a
v-if="list.subname"
class="nav-link dropdown-toggle"
data-toggle="dropdown"
role="button"
aria-haspopup="true"
aria-expanded="false"
>{{ list.name }}</a>
<a
v-else
class="nav-link"
role="button"
>{{ list.name }}</a>
<div v-for="sub in list.subname" :key="sub.id" class="dropdown-menu">
<a class="dropdown-item">{{ list.subname }}</a>
</div>
</li>
</ul>
I also want to check if there's a submenu on each menu, if there's a submenu it will create a dropdown else no dropdown for that menu
hope you guys help me.
Thank you
you can try this in v-if condition
v-if="list.subname.data.length > 0"
Hey Guys I have the following code which loops the <section> everytime I use it within the JSON. This works fine.
However, I am having problems with the nested loop {% for list in lists %} which handles the li elements. It comes out blank and seems to only loop twice when I inspect the element?
{# Question 1 #}
{% for question in questions %}
<section>
<div class="container question" id="question-one">
<div class="row row-eq-height">
<div class="gradient"></div>
<div class="col-md-1 green-box">
<div class="number"><span>1</span></div>
</div>
<div class="col-md-10 dark-grey-box text-center">
<div class="content-wrapper">
{{ question.text|markdown }}
{# SLIDER #}
<div class="row">
<div class="col-md-8 offset-md-2">
<div class="slider-container">
<ul class="list-inline justify-content-center range-labels">
{% for list in lists %}
<li class="list-inline-item"><img src="{{ list.img }}"><span>{{ list.label }}</span></li>
{% endfor %}
</ul>
<div class="range-wrapper">
<img src="../resources/images-assets/images/place-holder-slider.png">
</div>
</div>
</div>
</div>
<div class="cta-wrapper">
<button id="question-one-submit" onclick="buttonClick()">DONATE £1</button>
</div>
</div>
</div>
<div class="col-sm-1 dark-grey-box"></div>
</div>
</div>
</section>
{% endfor %}
In my JSON file I have laid everything out as follows:
"questions": [
{
"text": "##How confident are you in achieving your marketing goals this year?",
"lists": [
{ "img": "..\/resources\/images-assets\/images\/sad.svg", "label": "Dejected" },
{ "img": "..\/resources\/images-assets\/images\/sad.svg", "label": "Dejected" },
{ "img": "..\/resources\/images-assets\/images\/sad.svg", "label": "Dejected" },
{ "img": "..\/resources\/images-assets\/images\/sad.svg", "label": "Dejected" },
{ "img": "..\/resources\/images-assets\/images\/sad.svg", "label": "Dejected" }
]
}
],
I want the li to appear 5 times with the relevant image and label as I have added in the JSON file.
Can anyone point me in the right direction?
I managed to get this working correctly. Here is the markup:
{% for question in questions %}
<section>
<div class="container question" id="question-{{ loop.index }}">
<div class="row row-eq-height">
<div class="gradient"></div>
<div class="col-md-1 green-box">
<div class="number"><span>
{{ loop.index }}
</span></div>
</div>
<div class="col-md-10 dark-grey-box text-center">
<div class="content-wrapper">
{{ question.text|markdown }}
{# SLIDER #}
<div class="row">
<div class="col-md-8 offset-md-2">
<div class="slider-container">
<ul class="list-inline justify-content-center range-labels">
{% for option in question.options %}
<li class="list-inline-item"><img src="{{ option.img }}"><span>{{ option.label }}</span></li>
{% endfor %}
</ul>
<div class="range-wrapper">
<img src="images/place-holder-slider.png">
</div>
</div>
</div>
</div>
<div class="cta-wrapper">
<button id="button-{{ loop.index }}" onclick="buttonClick()">{{ question.button }}</button>
</div>
</div>
</div>
<div class="col-sm-1 dark-grey-box"></div>
</div>
</div>
</section>
{% endfor %}
The JSON file I am using to accompany this is as follows:
"questions": [
{
"text": "##How confident are you in achieving your marketing goals this year?",
"options": [
{ "img": "images/sad.svg", "label": "Dejected" },
{ "img": "images/thinking-2.svg", "label": "Doubtful" },
{ "img": "images/like.svg", "label": "Hopeful" },
{ "img": "images/check.svg", "label": "Upbeat" },
{ "img": "images/goal.svg", "label": "Surefire" }
],
"button": "DONATE £1"
},
{
"text": "##What are the greatest challenges you face?",
"options": [
{ "img": "images/money-bag.svg", "label": "Budget" },
{ "img": "images/team.svg", "label": "Resources" },
{ "img": "images/bar-chart.svg", "label": "ROI" },
{ "img": "images/timer.svg", "label": "Short-termis" },
{ "img": "images/martech.svg", "label": "Martech" }
],
"button": "DONATE £1"
},
{
"text": "##Where could external agencies add the most value?",
"options": [
{ "img": "images/networking.svg", "label": "ABM" },
{ "img": "images/increasing-stocks-graphic-of-bars.svg", "label": "Demand" },
{ "img": "images/options.svg", "label": "Strategy" },
{ "img": "images/full-items-inside-a-shopping-bag.svg", "label": "Sales Enablement" },
{ "img": "images/content.svg", "label": "Content" }
],
"button": "DONATE £1"
},
{
"text": "##Would you be interested in a further conversation?",
"options": [
{ "img": "images/thumb-down.svg", "label": "Don't contact me again" },
{ "img": "images/maybe.svg", "label": "Unlikely this year" },
{ "img": "images/info.svg", "label": "Need to know more" },
{ "img": "images/calendar.svg", "label": "Get a date in the diary" },
{ "img": "images/boy-broad-smile.svg", "label": "Call me now" }
],
"button": "DONATE £1"
}
],
I am new to Angularjs.
I want to store the values in cookieStore by splitting the values and need to use all the values in html page.
Login.controller.js
function(response) {
if (response.json.response.statuscode == 0 && response.json.response.statusmessage=='Success') {
AuthenticationService.SetCredentials(vm.username, vm.password);
$location.path('/');
console.log(response);
var resp = response;
$window.localStorage.set("response", JSON.stringify(resp));
var user = resp.json.response.user;
for(var i=0; i<user.length-1; i++){
var sessionid = resp.json.response.user[i].sessionid;
$cookieStore.put('sessionid', sessionid);
}
console.log(user);
console.log(JSON.stringify(sessionid));
} else {
FlashService.Error(response.json.response.statusmessage);
vm.dataLoading = false;
}
});
I am getting JSON response as below
{
"json": {
"response": {
"statuscode": "0",
"statusmessage": "Success",
"user": [
{
"groupname": "School BSK",
"membername": "Preethi Ritesh",
"session_id": "573eaea74a96c3442a2e45a0"
},
{
"groupname": " Office",
"membername": "Preethi Ritesh",
"session_id": "573eaea74a96c3442a2e45a2"
},
{
"groupname": "Team Developers",
"membername": "Preethi Ritesh",
"session_id": "573eaea74a96c3442a2e45a4"
},
{
"groupname": "Pavan School",
"membername": "Preethi",
"session_id": "573eaea74a96c3442a2e45a6"
},
{
"groupname": "Shubiksha Apartments",
"membername": "Preethi",
"session_id": "573eaea74a96c3442a2e45a8"
},
{
"groupname": "Shubiksha Apartments",
"membername": "Rohan Ritesh",
"session_id": "573eaea74a96c3442a2e45aa"
},
{
"groupname": "Little Millenium - Girinagar",
"membername": "Preethi",
"session_id": "573eaea74a96c3442a2e45ac"
},
{
"groupname": "Group App Testing",
"membername": "Preethi Ritesh",
"session_id": "573eaea74a96c3442a2e45ae"
},
{
"groupname": "Group App Testing",
"membername": "Ritesh Kumar",
"session_id": "573eaea74a96c3442a2e45b0"
},
{
"groupname": "Team Analysts",
"membername": "Preethi Ritesh",
"session_id": "573eaea74a96c3442a2e45b2"
},
{
"groupname": "Office",
"membername": "Preethi",
"session_id": "573eaea74a96c3442a2e45b4"
},
{
"groupname": "Office",
"membername": "Rohan Ritesh",
"session_id": "573eaea74a96c3442a2e45b6"
},
{
"groupname": "Office",
"membername": "PreethiEngineer",
"session_id": "573eaea74a96c3442a2e45b8"
},
{
"groupname": "Test SR",
"membername": "SR Tester",
"session_id": "573eaea74a96c3442a2e45ba"
},
{
"groupname": "Planet Kids Banashankari",
"membername": "Preethi Ritesh",
"session_id": "573eaea74a96c3442a2e45bc"
}
]
}
}
}
The json response is a dynamic response.
I need to store all the groupname, membername and sessionid seperately in cookie store and i need to show as "groupname-membername" in the form of list.
If the user clicks on anyone groupname-membername then I need to send the request to the backend with respective sessionid and I will get the response for that sessionid.
My home.view.html
<div class="container-fluid text-center" ng-controller="UserDataController as ctrl">
<div class="row content" style="margin-top:100px; color:rgba(51, 122, 183, 1);" ng-if="!model.displayHome">
<button ng-click="getData('/login.controller','','','GET')">Click to login</button>
</div>
<div class="row content" ng-if="model.displayHome">
<div class="col-sm-2 sidenav">
<div class="well well-lg col-xs-30" style="background-color: green;" ng-show="true">
<img class="img-responsive" style="padding-bottom:10px;" src="css/images/image.jpg" />
<div class="form-group">
<select class="form-control" ng-model="model.selectedValue" name="groupzname">
<option value='' disabled> Switch Account </option>
<option ng-repeat="item in model.dropDownData track by $index" value="{{item}}">{{item}}</option>
</select>
</div>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li><span class="glyphicon glyphicon-dashboard vmenu"></span> Dashboard
</li>
<li class="#/Profile"><span class="glyphicon glyphicon-user vmenu"></span>Profile
</li>
<li><span class="glyphicon glyphicon-edit vmenu"></span>Account
</li>
<li><span class="glyphicon glyphicon-tags vmenu"></span>Dropbox
</li>
<li><span class="glyphicon glyphicon-off vmenu"></span>Checklist
</li>
<li><span class="glyphicon glyphicon-off vmenu"></span>Report
</li>
<li><span class="glyphicon glyphicon-off vmenu"></span>Settings
</li>
<li><span class="glyphicon glyphicon-off vmenu"></span>Help
</li>
</ul>
</div>
</div>
<div class="col-sm-8 text-left" ng-show="true">
<h1>Welcome</h1>
<div class="form-group">
<label class="form-control" ng-model="model.membervalue" name="membername" style="border:none"> {{model.membervalue}}</label>
</div>
</div>
</div>
</div>
Before I used the above JSON file which contains JSON response and I fetched the values from that JSON file.
It was working fine but now I need to list values dynamically using backend response.
I have referred the file name "\login.controller" in "home.view.html" page as above and i am getting the below error
angular.js:8495 GET http://127.0.0.1:63100/login.controller 404 (Not Found)
I have a complex JSON. can I use this to create a tree view.Here is sample json. A project can have tasks, subprojects and can go to any depth.
$scope.data = [{
"id": 1,
"title": "node1",
"TaskNodes" : [
{
"id": 113,
"title": "Parent Task node1.1.3",
"TaskNodes": [{
"id": 1131,
"title": "Child Task node1.1.3",
"TaskNodes": []
}]
}
],
"nodes": [
{
"id": 11,
"title": "node1.1",
"TaskNodes" : [
{
"id": 112,
"title": "Task node1.1.2",
"TaskNodes": []
}
],
"nodes": [
{
"id": 111,
"title": "node1.1.1",
"nodes": []
}
]
},
{
"id": 12,
"title": "node1.2",
"nodes": []
}
],
}, {
"id": 2,
"title": "node2",
"nodes": [
{
"id": 21,
"title": "node2.1",
"nodes": []
},
{
"id": 22,
"title": "node2.2",
"nodes": []
}
],
}, {
"id": 3,
"title": "node3",
"nodes": [
{
"id": 31,
"title": "node3.1",
"nodes": []
}
],
}];
});
this is the render html using angular-ui-tree
<!-- Nested node template -->
<script type="text/ng-template" id="nodes_renderer.html">
<div ui-tree-handle class="tree-node tree-node-content">
<a class="btn btn-success btn-xs" ng-if="node.nodes && node.nodes.length > 0" nodrag ng-click="toggle(this)"><span class="glyphicon" ng-class="{'glyphicon-chevron-right': collapsed, 'glyphicon-chevron-down': !collapsed}"></span></a>
{{node.title}}
<a class="pull-right btn btn-danger btn-xs" nodrag ng-click="remove(this)"><span class="glyphicon glyphicon-remove"></span></a>
<a class="pull-right btn btn-primary btn-xs" nodrag ng-click="newSubItem(this)" style="margin-right: 8px;"><span class="glyphicon glyphicon-plus"></span></a>
</div>
<ol ui-tree-nodes="" ng-model="node.nodes" ng-class="{hidden: collapsed}">
<li ng-repeat="node in node.nodes" ui-tree-node ng-include="'nodes_renderer.html'">
</li>
</ol>
</script>
<script type="text/ng-template" id="TaskNodes_renderer.html">
<div ui-tree-handle class="tree-node tree-node-content">
<a class="btn btn-success btn-xs" ng-if="TaskNode.TaskNodes && TaskNode.TaskNodes.length > 0" nodrag ng-click="toggle(this)"><span class="glyphicon" ng-class="{'glyphicon-chevron-right': collapsed, 'glyphicon-chevron-down': !collapsed}"></span></a>
{{TaskNode.title}}
<a class="pull-right btn btn-danger btn-xs" nodrag ng-click="remove(this)"><span class="glyphicon glyphicon-remove"></span></a>
<a class="pull-right btn btn-primary btn-xs" nodrag ng-click="newSubItem(this)" style="margin-right: 8px;"><span class="glyphicon glyphicon-plus"></span></a>
</div>
<ol ui-tree-nodes="" ng-model="TaskNode.TaskNodes" ng-class="{hidden: collapsed}">
<li ng-repeat="TaskNode in TaskNode.TaskNodes" ui-tree-node ng-include="'TaskNodes_renderer.html'">
</li>
</ol>
</script>
<div ui-tree id="tree-root">
<ol ui-tree-nodes ng-model="data">
<li ng-repeat="TaskNode in data" ui-tree-node ng-include="'TaskNodes_renderer.html'"></li>
<li ng-repeat="node in data" ui-tree-node ng-include="'nodes_renderer.html'"></li>
</ol>
</div>
</div>
I need to create a tree view for this. i have found a lot of them for one children type but in my case its a double chidlren type.
Any help is appreciated. thanks.
Sanjeev