在要素存储中保持3个相同类型的对象,并且分离清晰。

时间:2018-05-22 06:16:28

标签: angular ngrx ngrx-store ngrx-store-4.0 ngrx-entity

我有三个服务根据不同的操作返回相同类型的对象。如何以完全分离的方式保存要素存储中的所有对象。

行动1:LOAD_CANDIDATES



    I have an effect that invokes below service call

    public getCandidates(): Observable {
        const url = 'Candidates Url';
        return this.http.get(url);
    }

措施2:LOAD_MATCHED_CANDIDATES



    I have an effect that invokes below service call

    public getMatchingCandidates(conditions: any): Observable 
    {
        const url = 'Matched Candidates Url';
        return this.http.get(url);
    }

行动3:LOAD_ASSIGNED_CANDIDATES



    I have an effect that invokes below service call

    public getAssignedCandidates(id: number): Observable {
        const url = 'Assigned candidates url';
        return this.http.get(url);
    }

我确实为每个人都有成功和失败的效果。



    Candidate reducer :

    export const reducers = {
      search: fromSearch.reducer,
      candidates: fromCandidates.reducer,
      collection: fromCollection.reducer
    };

    Here is the injection of feature store to module

    StoreModule.forFeature('candidates', combineReducers(fromStore.reducers))

如何在功能存储上同时拥有所有匹配和分配的候选项,并指定相应的对象类型(即匹配,分配这些对象)

0 个答案:

没有答案