Angular 4手动解析或更新数据
我正在使用带解析器的Angular 4路由器 我的例子很简单,我有一个项目Angular 4手动解析或更新数据,angular,angular-routing,Angular,Angular Routing,我正在使用带解析器的Angular 4路由器 我的例子很简单,我有一个项目/projects/:id,然后是一些子项目: /projects/:id/info /projects/:id/edit /projects/:id/房间 当使用解析器时,我只需从孩子们那里获得我的项目,如下所示: (<ActivatedRoute>this.route).parent.data.subscribe((data) => { this.project = data.proje
/projects/:id
,然后是一些子项目:
/projects/:id/info
/projects/:id/edit
/projects/:id/房间
(<ActivatedRoute>this.route).parent.data.subscribe((data) => {
this.project = data.project
});
(this.route).parent.data.subscribe((数据)=>{
this.project=data.project
});
但是当我编辑我的项目,例如添加或删除房间时,它不会被更新。因此,我需要找到一种方法来手动调用解析器或更新数据。现在我正在做一个
window.location.reload()当你解析数据时,只会发出一个可观察值(“热可观察值”作为值),而不是直接发出值