1
我有一个与我的组件有关的init数据的商店,这个数据的一个例子是一个字符串与apiPath。如何等待,直到一个商店被执行后,分配一个动作dispach第二个动作
ngOnInit() {
// this store contains data related to the component
this.store.dispatch(this.searchActions.addPageData(this.pageData));
}
然后我从以前的存储需要的数据和被触发每当有一个路线PARAM变化另一个动作:
this.route.params.subscribe((params: Params) => {
this.store.dispatch(this.searchActions.routerParamsSearchPageChanged(pageFilters));
})
你怎么等到第一个行动,以填补商店,派遣第二个动作。
http://stackoverflow.com/questions/35173649/angular2-how-to-chain-async-service-calls-http-requests-in-a-component – silentsod
我想这可能与:HTTP ://stackoverflow.com/questions/40872357/waiting-for-ngrx-action-before-loading-page-with-url-parameter/40905330 – chrigu
http://stackoverflow.com/questions/40343835/performing-advanced-http -requests-in-rxjs/40346998,http://stackoverflow.com/questions/41092488/rxjs-json-data-with-an-array-processing-each-item-further-in-the-stream/41096657,http ://stackoverflow.com/questions/39566268/angular-2-rxjs-how-return-stream-of-objects-fetched-with-several-subsequent/39578646#39578646 – martin