Once the datatable has been rendered, I am facing an issue where I cannot update the data. I'm utilizing angular2-datatable.
In my appcomponent.html file:
If I try to update 'data2' in my appcomponent.ts file as shown below:
this.httpservice.getdata().subscribe
(data=>
{
this.data2 = data;
for (let i = 0; i < 21; i++) {
markerarray[i] = new google.maps.Marker({
position: new google.maps.LatLng(this.data2[i].latitude, this.data2
[i].longitude),
title: this.data2[i].name,
map: map
});
}
google.maps.event.addListener(map, 'idle', function () {
var bounds = map.getBounds();
for (var i = 0; i < 20; i++) {
var marker = markerarray[i];
if (bounds.contains(marker.getPosition()) === true) {
// This line doesn't work for me
this.data2.length = 0;
}
}
});
})
I aim to clear the datatable once the markers are within the boundaries.