使用ngrx时,Angular 4解析未完成

Dav*_*vid 5 ngrx angular

我正试图在我的应用程序中使用ngrx解析,并且由于某种原因它无法正常工作.

这是我之前使用解析路径中的简单服务获得它的方式:

resolve() {
  return this.service
    .getData()
    .map(data => data.pages.filter(page => page.parent === 'home'));
}
Run Code Online (Sandbox Code Playgroud)

然后我把它改成了这个:

resolve() {
  this.store.dispatch(new LoadConfigAction());
  return this.store
    .select('configuration')
    .do(data => console.log(data))
    .map((data: any) => data.pages.filter(page => page.parent === 'home'));
}
Run Code Online (Sandbox Code Playgroud)

我在我的控制台中获取数据,因此正在检索数据,但解决的问题显然没有完成,因此导航不会发生.

我想知道是否可能来自this.store的返回类型与我的服务中的Observable不同,但我有点迷失.

有任何想法吗?

und*_*ned 8

您需要完成流.

return this.store
    .select('configuration')
    .do(data => console.log(data))
    .map((data: any) => data.pages.filter(page => page.parent === 'home'))
    .first()
Run Code Online (Sandbox Code Playgroud)