我想知道如何发送已经存在的默认数据getWithQuery()
,如下所示:
@Injectable({providedIn: 'root'})
export class CompaniesDataService extends DefaultDataService<Company> {
private readonly _URL: string = '/api/companies';
private readonly _DEFAULT_QUERIES: QueryParams = {top: '0', limit: '10', order: "name"};
constructor(http: HttpClient, httpUrlGenerator: HttpUrlGenerator) {
super('Company', http, httpUrlGenerator);
}
getWithQuery(queryParams: QueryParams | string = this._DEFAULT_QUERIES): Observable<Company[]> {
return this.http
.post<FmsHttpResponse<Company>>(`${this._URL}/search`, queryParams)
.pipe(map(response => response.content));
}
}
我的意思this._DEFAULT_QUERIES
是默认传递queryParams
。getWithQuery()
当我像这样使用解析器添加功能时:
return this.companyEntityService.getWithQuery()
.pipe(tap(() => this.companyEntityService.setLoaded(true)));
我得到错误:Expected 1-2 arguments, but got 0.
。
任何想法?我想补充一点,我是一个新手 ngrx 程序员,也许这是一个简单的问题,我找不到答案。