Estoy comenzando en esto de implementar el backend con el frontend, tengo un error debe ser simple y no lo veo, este es mi código...
Este seria mi componente que quiero mostrar en mi servidor local: Ahi indico donde me subraya el error, y al pasar el mouse por encima, me dice: Identifier 'Reclamos' is not defined. The component declaration, template variable declarations, and element references do not contain such a member.
Y no me facilita el Quick fix.
<ul>
<li *ngFor="let r of Reclamos"> <--------(MI ERROR SE MUESTRA AHI EN LA PALABRA Reclamos)
<span>{{r.num_reclamo}}, {{r.tipo_problema}}, {{r.fecha}}</span>
</li>
</ul>
Este es mi models de los atributos:
export interface Reclamos {
num_reclamo: number;
rut_usuario: number;
tipo_problema: string;
fecha: string;
texto_reclamo: string;
estado: string;
SLA_reclamo: number;
fecha_tope: string;
}
Este es mi codigo en la parte del component.ts
import { Component, OnInit } from '@angular/core';
import { ReclamosService } from 'src/app/services/reclamos-service.service';
import { Reclamos } from 'src/models/Reclamos';
@Component({
selector: 'app-busqueda-reclamo',
templateUrl: './busqueda-reclamo.component.html',
styleUrls: ['./busqueda-reclamo.component.css']
})
export class BusquedaReclamoComponent implements OnInit {
reclamos: Reclamos[];
constructor(private reclamosService: ReclamosService) { }
ngOnInit(){
this.obtenerReclamos();
}
obtenerReclamos() {
this.reclamosService.obtenerReclamos().subscribe(reclamos => this.reclamos = reclamos);
}
}
Este seria mi servicio.ts
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Reclamos } from 'src/models/Reclamos';
@Injectable({
providedIn: 'root'
})
export class ReclamosService {
private URL = 'localhost:8080/api'
constructor(private http: HttpClient) { }
obtenerReclamos(): Observable<Reclamos[]>{
const suffix = '/reclamos/usuario'
return this.http.get<Reclamos[]>(this.URL+suffix);
}
}
De ante mano agradezco por sus tiempo y respuestas, gracias ;).