在执行 ng build --prod 时从 angular 4 升级到 angular 5 时出错
Getting error on ugrading to angular 5 from angular 4 on doing ng build --prod
错误:无法解析 client-src/app/shared/services/touch-systems 中 TouchSystemsService 的所有参数。service.ts: ([object Object], ?, [object Object]).
这是我的服务:
export class TouchSystemsService extends BehaviorSubject{
baseUrl: string ;
constructor(public http: HttpClient, private apiEndPoint: string, private
configService: ConfigService) {
super(null);
this.baseUrl = '/api';
}
public fetchById(id: number, state?: State): Observable<any>
{
if (!state) {
let options = this.CreateHeaders();
return this.http.get<any>(`${this.baseUrl}/${this.apiEndPoint}/${id}`,
options);
}
const queryStr = `${toDataSourceRequestString(state)}`;
const hasGroups = state.group && state.group.length;
let options = this.CreateHeaders();
let result = this.http.get<any>(`${this.baseUrl}/${this.apiEndPoint}/${id}?
${queryStr}`, options);
return result;
}
这是对上述服务进行扩展的服务
export class SizeService extends TouchSystemsService {
dataResult: GridDataResult;
constructor(http: HttpClient, configService: ConfigService) {
super(http, 'size', configService);
}
public read(id:number): Observable<GridDataResult> {
return this.fetchById(id);
}
我正在使用 angular 版本 Angular: 5.2.10
我缺少的是无法直接从 angular 访问此服务,因此不需要可注入(此服务也不需要提供程序)。因此删除了“@Injectable”指令并将其从 app.module.ts 的提供者中移除。
错误:无法解析 client-src/app/shared/services/touch-systems 中 TouchSystemsService 的所有参数。service.ts: ([object Object], ?, [object Object]).
这是我的服务:
export class TouchSystemsService extends BehaviorSubject{
baseUrl: string ;
constructor(public http: HttpClient, private apiEndPoint: string, private
configService: ConfigService) {
super(null);
this.baseUrl = '/api';
}
public fetchById(id: number, state?: State): Observable<any>
{
if (!state) {
let options = this.CreateHeaders();
return this.http.get<any>(`${this.baseUrl}/${this.apiEndPoint}/${id}`,
options);
}
const queryStr = `${toDataSourceRequestString(state)}`;
const hasGroups = state.group && state.group.length;
let options = this.CreateHeaders();
let result = this.http.get<any>(`${this.baseUrl}/${this.apiEndPoint}/${id}?
${queryStr}`, options);
return result;
}
这是对上述服务进行扩展的服务
export class SizeService extends TouchSystemsService {
dataResult: GridDataResult;
constructor(http: HttpClient, configService: ConfigService) {
super(http, 'size', configService);
}
public read(id:number): Observable<GridDataResult> {
return this.fetchById(id);
}
我正在使用 angular 版本 Angular: 5.2.10
我缺少的是无法直接从 angular 访问此服务,因此不需要可注入(此服务也不需要提供程序)。因此删除了“@Injectable”指令并将其从 app.module.ts 的提供者中移除。