I am currently utilizing the Iterable Differs feature in Angular2 to monitor changes in my data. However, I am facing an issue where the differ.diff method always returns "null" and I am unsure of the reason behind this.
constructor(differs: IterableDiffers) {
this.differ = differs.find([]).create(null);
}
@Input() data: any;
ngDoCheck() {
var changes = this.differ.diff(this.data.datasets);
if (changes && this.initialized) {
//reload the view
}
EDIT:
this.pingService.pingStream.subscribe(ping => {
this.ping = ping;
console.log(this.ping);
NTWDATA.datasets[0].data.shift();
NTWDATA.datasets[0].data.push(this.ping);
The PingService provides a number every 5 seconds by pinging the server. The shift/push operations are functioning correctly, and the data is being updated. However, it is not being detected. NTWDATA:
{
labels: ["", "", "", "", "", "", ""],
datasets: [
{
label: 'Server Response Time in ms',
data: [65, 59, 80, 81, 56, 55, 40],
fill: false,
borderColor: '#FF0303'
}
]
}