Quiero actualizar datos en InMemoryDBService pero no funciona. Probablemente es un problema con client.id. Creo que porque en client.service.ts intenté mostrar en console.log user.id (como puedes ver en mi código) pero no lo he definido. Pero client.name muestra correctamente el texto. Así que hice un objeto hola con id (mira mi código) pero tampoco funciona. no tengo ningun error Este código no cambia los datos de los clientes y no tengo idea de por qué. Así que mira mi código: clients-data.service
createDb(){ const clients = [ { id: 1, name: 'Jan Kowalski', city: 'Lublin', streetNumber: 4, flatNumber: 12 }, { id: 2, name: 'Jan Nowak', city: 'Lublin', streetNumber: 4, flatNumber: 12 }, { id: 3, name: 'Marian Stefański', city: 'Lublin', streetNumber: 4, flatNumber: 12 }, ]; return { clients }; } genId(clients: Client[]): number { return clients.length > 0 ? Math.max(...clients.map(client => client.id)) + 1 : 11; }cliente.servicio.ts
private clientsURL = 'api/clients'; updateClient(client: Client): Observable<any> { const hello = {id: 2, name: 'Hello World', city: 'Test', streetNumber: 'Test', flatNumber: 3}; return this.http.put(this.clientsURL, client, this.httpOptions).pipe( tap(_ => console.log(`updated hero id=${client.id}`)), catchError(this.handleError<any>('updateHero')) ); }detalles-del-cliente.components.ts
update(): void { if(this.client){ this.clientService.updateClient(this.updateClientForm.value as Client) .subscribe(() => this.goBack()); } }¿Dónde me equivoco?