Reputation: 16038
I have a component which has an Event Emitter as follows:
@Output() onLoadRequired: EventEmitter<any> = new EventEmitter<any>();
This would be used something like:
<my-component (onLoadRequired)="loadStuff()" />
Where the loadStuff
method returns a Promise<any>
.
I need the my-component
to know when the loadStuff
promise has been resolved. How can this be achieved?
Upvotes: 2
Views: 741
Reputation: 657416
If you make loadStuff()
return a Promise
this should work:
<my-component #mycomponent (onLoadRequired)="loadStuff().then(val => mycomponent.done()" />
done()
in <my-component>
is called when the promise resolves.
(not tested)
Upvotes: 2