Open rahul6612 opened 5 years ago
you have to provide hotel id also in
this.hotelEditForm = this.fb.group({
id:[''],
name:[''],
price:[''],
......
here2
private initHotelForm(){
let hotelId:number=null;
let hotelName = '';
.....
here also
if(this.editMode){
this.hotelService.getHotel(this.id).subscribe(data => {
const hotel = data;
hotelId = hotel.id;
hotelName = hotel.name;
.....
and finally
this.hotelEditForm.controls['id'].setValue(hotelId);
this.hotelEditForm.controls['name'].setValue(hotelName);
and have you done!
check updateHotel() method in hotel.service.ts file and onUpdateHotel() method in hotel-edit.component.ts file. the problem is when i am trying to update a single hotel using onUpdateHotel() method i am getting error: "Missing 'hotels' id" what i am doing wrong?
hotel.service.ts file
hotel-edit.component.ts file