I can’t seem to get my head around how to do this in the newer version of Angular. In version 1 I would use $defer and $emit but Angular4 does not use those methods.
Basically I have a page which passes data to a provider, the provide will call a number of functions within itself and one of those functions will generate as a solution. When that solution is generated it should be passed the back the page that called the provider.
Can I use something like the emit call within a component? or has some has an example of a callback which is more complex than a simple http call.
That’s not an idiomatic way to think in Angular apps. Instead, the provider should return a future (Promise or Observable) that resolves when the answer is ready.
I would not use events for this, because it needlessly breaks up what is logically a single (albeit asynchronous) operation. Which makes more sense to you: