the data of api is array but the response i am getting from it is as an object using following method
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-shipment',
templateUrl: './shipment.component.html',
styleUrls: ['./shipment.component.css'],
})
export class ShipmentComponent implements OnInit {
li: any;
shipment = [];
constructor(private http: HttpClient) {}
ngOnInit(): void {
this.http.get('http://localhost:3000/shipments').subscribe((response) => {
this.li = response;
});
}
getShipments(): void {
console.log(this.li);
}
}