Hi,
I am using custom angularjs directives and trying to bind data coming in
json format. The json has sub array of object as well.I need to bind
sub-array to my html. I've done the following. If the employeeList is null
then i need to show div and span with 0 value. If any property of
employeeList is not availble it should be bound to 0 but when i do the
following it's not working prroperly. I dont understand what i am doing
wrong here.
*HTML*
<div class="container" ng-controller="profileController" ng-init=
"loadProfilesData()">
<div ng-repeat="p in profileData">
<div>{{p.company}}</div>
<div>{{p.department}}</div>
<div ng-repeat="emp in p.employeeList"></div>
<div ng-if="emp.Tag== 'Devo100'" gauge-chart class="gauge" id=
"Devo100-{{p.Id}}" value=p.Value*100></div>
<div ng-if="emp.Tag!= 'Devo100'" gauge-chart class="gauge" id=
"Devo100-{{p.Id}}" value=0></div>
<div ng-if="emp.Tag== 'Devo101'" gauge-chart class="gauge" id=
"Devo101-{{p.Id}}" value=p.Value*100></div>
<div ng-if="emp.Tag!= 'Devo100'" gauge-chart class="gauge" id=
"Devo100-{{p.Id}}" value=0></div>
<span ng-if="emp.Tag== 'Devo102'">
{{ p.Value | date: "hh:mm:ss" }}
</span>
<span ng-if="emp.Tag!= 'Devo102'">
0
</span>
</div>
</div>
</div>
Json that i get is following
profileData: [
{
ID: "1",
employeeList: [{"Value":0.003,"Stat":{"parameter":0,
"Name":"test0","Tag":"Devo100"}},
{"Value":0.004,"Stat":{"parameter":0,"Name"
:"test1","Tag":"Devo101"}},
{"Value":0.005,"Stat":{"parameter":0,"Name"
:"test2","Tag":"Devo102"}}],
comapny: "MSDFT",
department: "Sales"
},
{
ID: "2",
employeeList: null,
comapny: "MSDFT",
department: "HR"
},
{
ID: "3",
employeeList: [{"Value":0.003,"Stat":{"parameter":0,
"Name":"test0","Tag":"Devo100"}},
{"Value":0.004,"Stat":{"parameter":0,"Name"
:"test1","Tag":"Devo101"}}],
comapny: "MSDFT",
department: "Development"
},
{
ID: "4",
employeeList: [{"Value":0.1,"Stat":{"parameter":0,"Name":
"test2","Tag":"Devo102"}},
{"Value":0.25,"Stat":{"parameter":0,"Name":
"test1","Tag":"Devo101"}}],
comapny: "MSDFT",
department: "Finance"
},
{
ID: "5",
employeeList: [{"Value":0.233,"Stat":{"parameter":0,
"Name":"test0","Tag":"Devo100"}}],
comapny: "MSDFT",
department: "Accounts"
}
]
Do i need to use two ng-repeat as i did above or the inner array of objects
can be bound using single ng-repeat. The div id's should be unique.
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.