How can I pass data retrieved in my service back out to a component every time a new data/URL is passed to it and loop over it with NgFor? I would like to use promises and not observables.
For clarification: Service(A) needs to pass its object to Component(B) every time the data changes and then loop over it with NgFor. Thanks in advance
here's my code:
SERVICE(A)
receiveEvent(eventId){
return fetch(eventId).then(res => res.json())
.then((data:any) => {
console.log(data);
});
RECEIVING COMPONENT(B)
requestEvent(requestUrl){
this._clientService.receiveEvent(requestUrl)
}