Angular2:Sharing data between components via routes -Subject

风流意气都作罢 提交于 2019-12-11 04:22:38

问题


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.

来源:https://stackoverflow.com/questions/45864989/angular2sharing-data-between-components-via-routes-subject

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!