我已经将我的应用更新为角度5,然后我的角度为2,我的常见模拟看起来像那个
export class CommonMocks{
static HttpMocks(): any[] {
return{
provide: myAppHttpHandler,
useFactory: (http: HttpClient) => {
return new myAppHttpHandler(http)
}
}
}
}
}
升级后我将myAppHttpHandler类更改为:
import { HttpClient } from "@angular/common/http";
export class myAppHttpHandler{
constructor(http:HttpClient){} //was Http from @angular/http
}
现在我在尝试运行测试时遇到错误:
zone.js?fad3:169未捕获错误:无法解析useFactory的所有参数:(?)。
任何人都可以用最小的变化来解释我该怎么办?
谢谢