I'm new to Angular2, and started off writing an app where all methods were in main.ts
, and that file in turn referenced its view in main.html
. I refactored this app into subcomponents and services. So, I now have:
- app.component.ts
- app.html
- sub.component.ts
- sub.html
- data.service.ts
sub.component
is included as a directive in app.component
. app.compontent
injects data.service
and I can call the service from a click event in app.component
.
The Question
Previously, I could update a progress bar on the view from a function in the component. Now that the function is in its own service, how do I update the user on the progress of the long-running (recursive) method in the service? I assume I have to pass the progress from the service to app.component
or sub.component
, but how is this meant to be done?