gpt4 book ai didi

angular - 未捕获的类型错误 : StaticInjectorError(Platform: core)[t]: Cannot set property '_injector' of undefined

转载 作者:太空狗 更新时间:2023-10-29 18:19:08 25 4
gpt4 key购买 nike

源代码包含一个 rest API 调用以及全局变量引用,我也只使用了 bootstrap CSS 而没有保存 jquery,因为我没有使用 bootstrap.js执行(ng build -prod)后我得到了 prod 构建文件,并且在我的本地服务器上一切正常。但是,当我在其他服务器上合并到 JSP 代码时,出现错误“Uncaught TypeError: StaticInjectorError(Platform: core)[t]:无法设置未定义的属性“_injector””

最佳答案

这对我有用。

来自 app.module.ts:

import { HttpClientModule, HttpClient } from '@angular/common/http';
import { HttpModule} from '@angular/http';
...
imports:[HttpClientModule, HttpModule]

摘自 github 上的这些人。 https://github.com/angular/angular/issues/20096

似乎某些东西仍在使用 HttpModule,即使您很可能已切换到 HttpClient。

希望它对你有用。

关于angular - 未捕获的类型错误 : StaticInjectorError(Platform: core)[t]: Cannot set property '_injector' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48707044/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com