fix DI in BaseHttpDataSourceOptionsBuilder since inject is not compatible with no injectable classes
This commit is contained in:
parent
8a1dc9eb36
commit
ce880013cc
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@openharbor/ngx-data",
|
||||
"version": "18.0.0-alpha.5",
|
||||
"version": "18.0.0-alpha.6",
|
||||
"repository": "https://git.openharbor.io/Open-Harbor/ngx-data",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@ -14,7 +14,6 @@ import {
|
||||
} from "@openharbor/data";
|
||||
import {Observable, of, throwError} from "rxjs";
|
||||
import {catchError, switchMap} from "rxjs/operators";
|
||||
import {inject} from "@angular/core";
|
||||
|
||||
export abstract class BaseHttpDataSourceOptionsBuilder<TQuery, TModel> {
|
||||
protected _commands: { [key: string]: IDataSourceCommandAdapterOptions<any>; } = {};
|
||||
@ -22,7 +21,8 @@ export abstract class BaseHttpDataSourceOptionsBuilder<TQuery, TModel> {
|
||||
protected _defaultCriteria: IQueryCriteria;
|
||||
protected _query: IDataSourceQueryAdapterOptions<TQuery, TModel>;
|
||||
|
||||
readonly http: HttpClient = inject(HttpClient);
|
||||
constructor(protected readonly http: HttpClient) {
|
||||
}
|
||||
|
||||
createDataSource(): IDataSource<TQuery, TModel> {
|
||||
return new DataSource<TQuery, TModel>(this.createOptions());
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Inject, Injectable} from "@angular/core";
|
||||
import {inject, Inject, Injectable} from "@angular/core";
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpDataSourceOptionsBuilder } from "./HttpDataSourceBuilder";
|
||||
import { SingleDataSourceOptionsBuilder } from "./SingleObjectDataSourceBuilder";
|
||||
@ -9,17 +9,17 @@ import { ListDataSourceOptionsBuilder } from "./ListDataSourceBuilder";
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class HttpDataSourceService {
|
||||
@Inject(HttpClient) protected http!: HttpClient;
|
||||
protected http: HttpClient = inject(HttpClient);
|
||||
|
||||
builder<TQuery, TModel>() {
|
||||
return new HttpDataSourceOptionsBuilder<TQuery, TModel>();
|
||||
return new HttpDataSourceOptionsBuilder<TQuery, TModel>(this.http);
|
||||
}
|
||||
|
||||
singleBuilder<TQuery, TModel>() {
|
||||
return new SingleDataSourceOptionsBuilder<TQuery, TModel>();
|
||||
return new SingleDataSourceOptionsBuilder<TQuery, TModel>(this.http);
|
||||
}
|
||||
|
||||
listBuilder<TQuery, TModel>() {
|
||||
return new ListDataSourceOptionsBuilder<TQuery, TModel>();
|
||||
return new ListDataSourceOptionsBuilder<TQuery, TModel>(this.http);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user