Angular 4 resolution not completed when using ngrx

I am trying to use ngrx in a solution in my application and for some reason does not work.

Here's how I got it earlier using a simple service on my permission path:

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

Then I changed it to the following:

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'));
}

I get the data in my console, so the data is retrieved, but the resolved one does not seem to end, so my navigation does not happen.

I am wondering maybe the return type from this.store does not match the observable from my service, but I am a bit lost.

Any ideas?

+4
source share
1 answer

You need to fill in the stream.

return this.store
    .select('configuration')
    .do(data => console.log(data))
    .map((data: any) => data.pages.filter(page => page.parent === 'home'))
    .first()
+5
source

Source: https://habr.com/ru/post/1681444/


All Articles