I'm using a method that erases the files from the database by clicking on the trash when I click it, but it does not get updated in the view if I do not do f5 in the browser as I could do this without having to update the page
import { Component,DoCheck } from '@angular/core';
import { Http } from '@angular/http'
import {HttpClient} from '@angular/common/http';
import {LoginService} from '../api/login/login.service';
@Component({
selector: 'app-main',
templateUrl: './main.component.html',
styleUrls: ['./main.component.css'],
providers:[LoginService]
})
export class MainComponent implements DoCheck {
public archivo;
constructor(private _http: HttpClient,
public _servicio:LoginService) {
}
borrar(archivo){
console.log(archivo);
this._servicio.borrararchivos(archivo).subscribe(data => {
}, error => {
console.log('error');
});
}
here is my application as you see it deletes the object but it is not updated or deleted in the view
and my service is as follows
borrararchivos(id): Observable<any>{
const url = 'http://localhost/api/public/delete/${id}';
let headers = new HttpHeaders().set('token',this.token);
return this._http.delete(url,{headers:headers});
}