Mi función put no funciona, este es mi servicio
updateP(partecipanti: Partecipanti): Observable<any> { return this.http.put(this.partecipantiUrl, partecipanti, this.httpOptions).pipe( tap(_ => this.log(`updated p id=${partecipanti.id}`)), catchError(this.handleError<any>('update')) ); }en mi componente tengo
save(): void { if (this.part) { this.PartecipanteService.updateP(this.part) .subscribe(() => this.goBack()); alert("Partecipante modificato correttamente") } }y llamo a la función guardar en un botón
¿Qué está pasando exactamente? ¿Ves todos los registros? ¿Qué ve en la pestaña de red del navegador, se activa la solicitud PUT? ¿La solicitud está completa o aún está pendiente?
intente agregar algunos registros y manejar el error de todos modos:
save(): void { console.log('will save'); if (this.part) { console.log('this.part is true'); this.PartecipanteService.updateP(this.part) .subscribe(() => {console.log('ok it works');this.goBack()}, err => console.error('got an error', err) ); alert("Partecipante modificato correttamente") } }