I'm trying to use ngrx in a resolve in my app and for some reason it's not working.
This is how I got it previously, using a simple service in my resolve route:
resolve() {
return this.service
.getData()
.map(data => data.pages.filter(page => page.parent === 'home'));
}
I then changed it into this:
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 data in my console, so data is being retrieved, but the resolved is apparently not finishing, so my navigation does not happen.
I'm wondering if maybe the return type from this.store is not the same as an Observable from my service, but I'm a bit lost.
Any ideas?
You need to complete the stream.
return this.store
.select('configuration')
.do(data => console.log(data))
.map((data: any) => data.pages.filter(page => page.parent === 'home'))
.first()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With