如何在angularJS中将数据从一个html页面传递到另一页面?
问题描述:
我有两个html页面.第一页是患者列表,每个患者列表都是超链接.预期的行为是,在单击超链接(对应于患者)后,应将用户重定向到另一个具有相应患者详细信息的html页面.重定向正在发生.但是,我无法将数据从第一个html页传递到第二个html页.
I have two html pages. First page being a list of patients each being a hyperlink. The expected behavior is that, on click of a hyperlink ( corresponding to a patient), the user should be redirected to another html page which has the details of the corresponding patient. The redirection is happening. But, I am not able to pass the data from the first html page to the second one.
答
有很多方法可以做到这一点:
There are plenty of way to do that:
- 浏览器的本地存储(角度插件)
- URL参数(角度$ location )
- 服务器端会话
- 如今已经过时且效率低下的Cookie,最好选择#1(使用带角度的cookie)
最合适的实现方式取决于您正面/背面的体系结构
Best applicable implementation depends on your architecture on front/back