I have a list in which I need get the value depending on certain calculations. Check out the below code for more understanding.
$scope.allcolors = [
{ id:1, color:'#67b05c' },
{ id:2, color:'#7dc47a'},
{ id:3, color:'#b4cf8a' },
{ id:4, color:'#c7c354'},
{ id:5, color:'#e5e154' },
{ id:6, color:'#e5e154'},
{ id:7, color:'#eb9d54' },
{ id:8, color:'#db8a42'},
{ id:9, color:'#cf9373' },
{ id:10, color:'#db755e'}
];
if(r_header.severity){
console.log("sev", r_header.severity);
for (var i in $scope.allcolors) {
if ($scope.allcolors[i].id == r_header.severity) {
console.log("color", object.values($scope.allcolors[i]))}
}}
r_header.severity is an integer variable which will either have values from 1 to 10. Depending on this value, I need to get color specified in the list. The above code flags Object not defined error. I checked for similar references but nothing seems to be appropriate with my case.
objectwill beObject.