0

I'm trying to learn angular 2. I have imported ng2-upload-file. Now, I have an upload button in one of my component. In the backend, I analyze the uploaded file and change it and then display the result in another component.

this is the function called when upload is completed.

this.uploader.onCompleteItem = (item: any, response: any, status: any, headers: any) => {
    let responsePath = JSON.parse(response);
};

Now, I want my other component noticed when upload is completed. Also, response of uploaded data should be displayed in that component. How I can do that?

ranakrunal9
  • 13,320
  • 3
  • 42
  • 43
Cory
  • 929
  • 12
  • 19
  • 2
    You can create one shared service to handle this. check https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service – ranakrunal9 Dec 16 '16 at 09:37
  • 1
    Is your other component a parent component of this one? – Robin-Hoodie Dec 16 '16 at 09:57
  • Possible duplicate of [components communication through ](http://stackoverflow.com/questions/39834286/components-communication-through-router-outlet) – Tiberiu Popescu Dec 16 '16 at 09:59
  • i've followed the cookbook and now it works. thank you all guys. ranakrunal9, NexusDuck, tibbus – Cory Dec 16 '16 at 11:12

0 Answers0