Waiting for ngrx action before loading page with URL parameter

前端 未结 3 1015
无人共我
无人共我 2020-12-18 01:44

I\'m building an ng2 application using ngrx. When the app is launched a web service is called to get initial data, once this data is fetched I create an INIT_DONE a

3条回答
  •  [愿得一人]
    2020-12-18 02:24

    You could select documents from the store and subscribe to it and emit your action from there:

    ngOnInit() {
      this.store.select("documents").subscribe(documents => {
        this.paramSubscription = this.route.params
          .select('id')
          .map((id) => new SelectAction(id))
          .subscribe(this.store);
      });  
    }
    

提交回复
热议问题