right now i'm playing with ASP.NET with Angular 6 in frontend and can't figure out what is happening. For short: i'm getting a empty json although backend is sending right values:
Model:
import { Car } from '../models/car';
import { Ad } from '../models/ad';
export class Owner {
Id: number;
Firstname: string;
Lastname: string;
Phone: number;
Email: string;
Cars: Car[];
Ads: Ad[];
}
Service:
/** GET owners list */
getOwners (): Observable<Owner[]> {
return this.http.get<Owner[]>(this.ownersUrl)
.pipe(
catchError(this.handleError('getOwners', []))
);
}
Owners Component:
getOwners(): void{
this.ownerService.getOwners()
.subscribe( owners => this.owners = owners);
}
Owners Html:
<nb-card class="nav-card">
<nb-card-body>
<nb-list>
<nb-list-item *ngFor="let owner of owners" >
{{owner.Id}}
</nb-list-item>
</nb-list>
</nb-card-body>
</nb-card>
What am i doing wroing? Service constantly giving me empty json body isn't nice :/