I've been trying to fetch the color of an element using AngularJS, but I'm not having any luck. Here is my code:
function getColor() {
var elements = document.getElementsByClassName("card-abbr");
$timeout(function() {
angular.forEach(elements, function(value) {
var color = value.css('color');
/*var color = value.style.color;*/
console.log(color);
});
}, 1000);
}
My CSS:
.card-abbr:nth-child(1n) {
color: #EF2525;
}
.card-abbr:nth-child(2n) {
color: #88ba41;
}
.card-abbr:nth-child(3n) {
color: #850057;
}
.card-abbr:nth-child(4n) {
color: #003f60;
}
.card-abbr:nth-child(5n) {
color: #588ba3;
}
But unfortunately, this code isn't returning anything for me. Can someone please assist?