Look at the image below;
Clickingeditinadditiontobeingdirectedtotheeditpagewastoloadtheform,howevertheformisnotloading,andseehowitis.
Itwastostaylikethis;
Idonotknowwhat'sgoingwrong,Ineedhelp.
Thisisthemethodintheclassofservices.
editEvento(token,id,evento){letparams=JSON.stringify(evento);letheaders=newHeaders({'Content-Type':'application/json','Authorization':token});returnthis._http.put(this.url+'evento/'+id,params,{headers:headers}).map(res=>res.json());}
Thisismycomponentclass.
import{desaparecer}from'./../../animation';import{environment}from'./../../../environments/environment';import{Evento}from'./../../models/evento';import{UploadService}from'./../../core/upload.service';import{EventoService}from'./../../core/evento.service';import{UserService}from'./../../core/user.service';import{Component,DoCheck,OnInit}from'@angular/core';import{Router,ActivatedRoute,Params}from'@angular/router';@Component({selector:'app-edit',templateUrl:'./edit.component.html',styleUrls:['./edit.component.css']})exportclassEditComponentimplementsOnInit{publictitle:string;publicevento:Evento;publicidentity;publictoken;publicurl:string;publicstatus;publicis_edit;constructor(private_route:ActivatedRoute,private_router:Router,private_userService:UserService,private_eventoService:EventoService,private_uploadService:UploadService){this.is_edit=true;this.title='AtualizarEvento';this.evento=newEvento('','','',2018,'','');this.identity=this._userService.getIdentity();this.token=this._userService.getToken();this.url=environment.url;}ngOnInit(){this.getEvento();}getEvento(){this._route.params.forEach((params:Params)=>{letid=params['id'];this._eventoService.getEvento(id).subscribe(response=>{if(!response.evento){this._router.navigate(['/home']);}else{this.evento=response.evento;}},error=>{console.log(<any>error);this._router.navigate(['/home']);});});}onSubmit(){varid=this.evento._id;this._eventoService.editEvento(this.token,id,this.evento).subscribe(response=>{if(!response.evento){this.status='error';}else{this.status='success';this.evento=response.evento;//Subirimagendoeventoif(!this.filesToUpload){this._router.navigate(['/evento',this.evento._id]);}else{//Subidadelaimagenthis._uploadService.makeFileRequest(this.url+'upload-image-evento/'+this.evento._id,[],this.filesToUpload,this.token,'image').then((result:any)=>{this.evento.image=result.image;this._router.navigate(['/evento',this.evento._id]);});}}},error=>{varerrorMessage=<any>error;if(errorMessage!=null){this.status='error';}});}publicfilesToUpload:Array<File>;fileChangeEvent(fileInput:any){this.filesToUpload=<Array<File>>fileInput.target.files;}}
And click here to get access to my repository.