1

Consider I have 3 components. 1. PatientComponent in /patient 2.PatientListComponent in /patient/list 3.PatientCareXComponent in /patient/care/x

I used behaviorsubject in patient.service.ts to cast the data from patientlistcomponent. I face some issues: 1. Initially in /patient/list page from where data arrives, I see data visible in PatientComponent in console.logs but not PatientCareXComponent. 2. When i move to /patient page from /patient/list, the visible data also disappears.

The code is as same as Angular2:RxJS Subject not responding to events and it is the same code in PatientComponent I have added in PatientCareXComponent . Please favour on this.

Gayathri
  • 1,776
  • 5
  • 23
  • 50
  • Could you post some code here? Or develop a plunker? If you are using data bindings, in many cases you don't need a `Subject` or `BehaviorSubject`, you can just use a service with simple properties. I have a blog post about it here: https://blogs.msmvps.com/deborahk/build-a-simple-angular-service-to-share-data/ – DeborahK Aug 24 '17 at 15:16
  • Most of them are router-outlet @DeborahK – Gayathri Aug 24 '17 at 15:21
  • If you could create a small plunker example of what you are trying to do, I could provide an example of how to do it with a simple service. Otherwise you can look at my plunker here: https://plnkr.co/edit/KT4JLmpcwGBM2xdZQeI9?p=preview – DeborahK Aug 24 '17 at 15:24

0 Answers0