Claims filter, with angular and spring boot

Viewed 180

I have tried to consume my spring boot rest api, with angular, to filter data, and I have not succeeded, it shows me a blank screen, the rest api works completely, I tried it using Swagger UI and it works.

My service.ts

  obtenerReclamoPorIDAdmin(num_reclamo: number): Observable<Reclamos>{
  const suffix = '/filtrarReclamoPorID/admin/'
  return this.http.get<Reclamos>(this.URL+suffix+num_reclamo);
  }

My component.ts

  ngOnInit(){
  this.obtenerReclamos();
  }
  obtenerReclamos() {
  this.reclamosService.obtenerReclamos()
  .subscribe(reclamos => this.reclamos = reclamos); 
  }

responderReclamo(num_reclamo: number){
  this.reclamosService.responderReclamo(num_reclamo)
    .subscribe(_=>this.obtenerReclamos());
}
volver(){
  this.ubicacion.back();
}

buscar(num_reclamo: number){
  this.reclamosService.obtenerReclamoPorIDAdmin(num_reclamo)
    .subscribe(_=> this.obtenerReclamos());
}

This is the button that activates the function in my component.html

<form>
    <p>

    <select name="nombre">
        <option value="opcion">Seleccione una opción</option>
        <option value="porNumReclamo">Busqueda N° Reclamo</option>
        <option value="porRut">Busqueda por RUT</option>
    </select>
    <input type="text" name="numeroR" #num_reclamo placeholder="Ingrese N° Reclamo o ...">
    </p>    
</form>
<button class= "botones" mat-raised-button color="primary" style="margin-right: 10px;" 
(click)="buscar(num_reclamo.value)" routerLink="/filtrado-usuario/{{num_reclamo}}">Buscar</button> 
1 Answers

You have both a routerLink and clink handler on the button. It is possible that your request is being fired correctly but you are navigating to a different component. Check your network log in your browser to verify if the request is completing successfully.

Related