Una vez que se procesa la tabla de datos, no puedo actualizar los datos. Estoy usando angular2-datatable.
En mi appcomponent.html:
Si actualizo data2 en mi archivo appcomponent.ts de esta manera:
this.httpservice.getdata().subscribe (data=> { this.data2=data; for (i = 0; i < 21; i++) { markerarray[i] = new google.maps.Marker({ position: new google.maps.LatLng(this.data2[i].latituide, this.data2 [i].longituide), //In this line title: this.data2[i].name, //and this 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.data2.length=0;// This is not working for me } } }); })Quiero vaciar la tabla de datos una vez que los marcadores estén enlazados.
Encontré una solución, aunque no estoy seguro de que esta sea la mejor manera.
He usado ChangeDetectorRef para detectar cambios.
constructor(private http: Http,private httpservice: HttpService,private ref: ChangeDetectorRef) { ref.detach(); setInterval(() => { this.ref.detectChanges(); },1000); }