Angular Route重用策略
我对 RouteReuseStrategy 有疑问。主要概念很明确,我将其实现为具有从列表到带有 shouldReuse 数据的详细组件的先前状态:
{ path: 'list', component: AppointmentListComponent, data: {shouldReuse: true}},< /code>
并按预期工作。
但流程应该是这样的:
首页->列表(http调用)->详细信息(http 调用)
当我从详细信息返回到列表时,不会触发 http 调用(这很好),但是如果我返回主页或菜单中存在的任何类型的链接,当我返回列表时(来自应用程序的其他部分)我想重做 http 调用以获得新数据。
基本上,如果我要退出列表组件,我想清理存储的路线,例如我要转到“个人资料”页面
更新:目前我放置了一个 data.key进入路由,如果密钥不同,我将清除存储的路由
有什么想法吗?
I have a doubt regarding RouteReuseStrategy. The main concept is clear and I implemented it to have the previous state from a list to the detail component with the shouldReuse data:
{ path: 'list', component: AppointmentListComponent, data: {shouldReuse: true}},
and works as expected.
But the flow shoud be like this:
Homepage -> List (http call) -> Detail (http call)
when I go back from Detail to List the http call is not triggered (it's fine), but if I go back to the Homepage or any kind of links present into the menu, when I come back to the List (from other parts of the application) I'd like to redo the http call in order to have fresh data.
Basically, I'd like to clean the stored route if I'm going out of my List component, for example I'm going to the Profile page
UPDATE: At the moment I put a data.key into the routing, and if the keys are different I'll clear the stored routes
Any Idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论