0
2秒ごとに更新されるAPIからオブジェクトの配列を取得します。私はこの配列の変更を探している$ watchを持っています。変更されたこれらの要素に背景色を設定するために、要素または要素が変更されたかどうか、およびそれらのインデックスを知る必要があります。 ありがとうございます。
$scope.$watch('recentUpdates', function(newValue, oldValue) {
if(oldValue != newValue && newValue != null){
$scope.recentUpdates= newValue;
console.log(newValue)
setColor(newValue) ;
}else{
console.log('hey, value is not changed!');
}
});
SetColor関数は、要素の色を更新するために要素のオブジェクトとインデックスを取得する必要があります。
ありがとうございました – Vitali