I'm using MongoDB database. I believe that most understand that to update a record it is extremely important to get the identifying key, that is _id , I am able to get the identifying key of the record doing so;
ngOnInit() {
const codigoLancamento = this._route.snapshot.params['id'];
}
But I have no idea how my method will receive this record using the method below;
onSubmit(){
var id;
this._restaurantAdminService.editRestaurant( id , this.restaurant).subscribe(
response => {
if(!response.restaurant) {
this.status = 'error';
} else {
this.status = 'success';
this.restaurant = response.restaurant;
}
},
error => {
var errorMessage = <any>error;
if(errorMessage != null){
this.status = 'error';
}
}
);
}
I am open to any questions you may have to help me resolve this issue.