I have a unique situation where my service returns a promise to the controller:
// .... within the service
this.RefreshData = function() {
this.data = $q.all( {images: ...., tags: ....});
}
RefreshData ();
// .... in the controller
function() OnImages() {.....};
ImageSrv.data.then(OnImages());
However, there has been an unexpected event elsewhere and I need to refresh my controller. Let's say a directive triggers my service and initiates a refresh:
ImageSrv.RefreshData();
Due to this change in promise, OnImages no longer fires as expected. Would it be appropriate to handle this using a promise along with an event? Ideally, I would like to simply do something like
ImageSrv.data.refresh()
This hypothetical method would reset the promise to "not resolved" status and attempt to resolve it again.