Я хочу показать список билетов на моем угловом интерфейсе.Я имею в виду показать ticketId
и place
, как на рисунке ниже.
Вот мой запрос от http://localhost:8080/api/customers

Вот результат: http://localhost:4200/customer
К сожалению, список заявок пуст.Я не знаю, как это показать.

Вот мой класс customer-details.component.html
<div *ngIf="customer">
<div>
<label>Name: </label> {{customer.name}}
</div>
<div>
<label>Surname: </label> {{customer.surname}}
</div>
<div>
<label>List of tickets: </label> {{customer.tickets}}
</div>
<span class="button is-small btn-danger" (click)='deleteCustomer()'>Delete</span>
<hr/>
</div>
Мой класс customers-list.component.html
<div *ngFor="let customer of customers | async" style="width: 300px;">
<customer-details [customer]='customer'></customer-details>
</div>
<div>
<button type="button" class="button btn-danger" (click)='deleteCustomers()'>Delete all</button>
</div>
Класс customer.service.ts
export class CustomerService {
private baseUrl = 'http://localhost:8080/api/customers';
constructor(private http: HttpClient) {
}
getCustomersList(): Observable<any> {
return this.http.get(`${this.baseUrl}`);
}
Мой класс customer.ts
export class Customer {
customerId: number;
name: string;
surname: string;
tickets: Ticket[];
}
export class Ticket {
ticketId: number;
place: number;
customerId: number;
flightId: number;
}
Класс customers-list.component.ts
export class CustomersListComponent implements OnInit {
customers: Observable<Customer[]>;
constructor(private customerService: CustomerService) { }
ngOnInit() {
this.reloadData();
}
reloadData() {
this.customers = this.customerService.getCustomersList();
}
}