I am currently in the process of making an API call and utilizing the received data in a Bootstrap Angular Table Widget.
The specific widget I am utilizing can be found here: Complete example (Angular powered bootstrap widget)
Ensure you are working with the complete example that includes the service and pagination features.
I attempted to replace the existing data with the response from my API call.
constructor(public service: CountryService) {
this.countries$ = service.countries$;
this.total$ = service.total$;
this.headers = new QueryList<NgbdSortableHeader>();
}
API service:
getusers2() {
return this.http.get<Country[]>(this.getusersEndpoint, this.httpOptions);
}
While this approach partially works and displays the expected output in the table, the service still relies on the hard-coded class COUNTRIES. As a result, the filtering, pagination, and searching functionalities do not function properly. How can I resolve this issue?
The primary objective is to set up a basic table on the page, fetch the data, and update the table accordingly with the API response.
An ideal solution would involve:
<ngbd-table-skeleton ngIf=loading></ngbd-table-skeleton>
<ngbd-table-complete ngIf=!loading [data]="countries"></ngbd-table-complete>
Here, I would set loading to true in the OnInit function, fetch the data, set the data, toggle loading to false, and display the updated table with functional pagination, filtering, and sorting.
Implementing this approach might be challenging given my current level of expertise in Angular. If anyone has a potential solution or alternative method, I would greatly appreciate your insights.