Tengo esta función y no se si se puede simplificar porque creo que es muy larga.
submitForm(){
if(this.operatoId){
this._oper.update(this.operatoId, this.registerForm.value).subscribe(
(val) => {
console.log("POST call successful value returned in body", val);
},
response => {
console.log("POST call in error", response);
},
() => {
console.log("The POST observable is now completed.");
});
} else{
this._oper.create(this.registerForm.value).subscribe(
(val) => {
console.log("POST call successful value returned in body", val);
},
response => {
console.log("POST call in error", response);
},
() => {
console.log("The POST observable is now completed.");
});
}
this._location.back();
this.toastr.success('Grup', '',{disableTimeOut:true,closeButton:true, positionClass:'toast-bottom-right'});
}
Gracias!