代码如下:
import { _HttpClient } from '@delon/theme';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
// tslint:disable-next-line: class-name
export class tools {
private http: _HttpClient;
loadSelect(http, url, params): Observable<String[]> {
const newUrl = url + params;
const select = [];
return this.http.get(newUrl).pipe(
map((res: any) => {
if (res.status === 0) {
for (const x of res.data) {
const obj = { label: '', value: '' };
obj.label = x.title;
obj.value = x.title;
select.push(obj);
}
}
return select;
}),
);
}
}
报错如下:
ERROR TypeError: Cannot read property 'get' of undefined
at tools.loadSelect (tools.ts:12)