I have a feature where I need to populate objects fetched from the backend.
ngOnInit() {
this.source.load(this.myService.findAll());
}
Within myService, I am using Axios to retrieve data from the backend. I can confirm that the data is successfully reaching the frontend.
public findAll(): any {
axios.get('http://localhost:8080/api/getAll')
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
})
}
How can I invoke the service from the component to obtain an array of objects?