last day (15 days later) » 

4:13 PM
0
A: Angular JS: How do i call a second service from controller and update the DOM with returned Object

Ali BARINYou can do it with the following; <div class="led" style="position:absolute" ng-class="{ 'green': status[std.id], 'red': !status[std.id] }"> You should update your studentViewDirectiveCtrl with the following; angular.module('adf.widget.student') .controller('studentViewDirectiveCt...

 
But returned result is an array of object which contains status of students that i passed.
 
If these status are ordered by student array, you can check with $index. I have updated my answer.
 
{ "status": [{ "id": 1, "stat": "true" }, { "id": 2, "stat": "false" }, { "id": 3, "stat": "false" }, { "id": 4, "stat": "true" }] } //this is my result
 
@SharathBangera I have updated my answer again. You can check my answer again.
 
Can you please tell me what $index in status[$index]. its adding "Red" class for everything.
 
4:13 PM
This is index of each rows/items of array. $index will be 0 for first row, 1 for second row etc. Do you share your $scope.student object too? Now, I will update my answer again.
 
4:40 PM
hey
sorry , i just checked the comment just now.
instead of $index i passed -> student.id and it worked
bt i i have doubt on whatever i have written
 
4:57 PM
are you there ?
 
 
5 hours later…
10:01 PM
Sorry Sharath,
I was out,
Now, I am on computer.
If you are here, we can talk about this subject.
And I got happy to hear that works.
I would be happy if you mark my answer as a solution.
 

last day (15 days later) »