我对如何开始跟踪这个问题感到茫然。来自Angular和/或Angular CLI专业人员的任何建议都将不胜感激。
我刚刚完成了使用angular-cli将Angular 2中的fulling迁移到带有angular / cli的Angular 4,并且除了这个之外,我已经能够完成迄今为止我所遇到的每一次迁移。
我根本不熟悉webpack /编译,但这看起来可能是Zone.js的问题,但我承认我只是认为,因为它是最后面出现的东西在堆栈跟踪中。
有关我应该从何处开始调试此类模糊错误的建议?
(不确定这是值得注意的,但是(我认为?)我将我的项目配置为使用ES(tsconfig.json
中的目标设置为es6
),但这些错误看起来像是他们的错误。来自es5
。我的理解是Angular 4仍然在es5
,所以这不应该是一个问题/惊喜,但我想我会指出这一点,以防它和&{ #39;相关。)
core.es5.js:1020 ERROR Error: Uncaught (in promise): Error: No provider for [object Object]!
Error: No provider for [object Object]!
at injectionError (core.es5.js:1169)
at noProviderError (core.es5.js:1207)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._throwOrNull (core.es5.js:2649)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKeyDefault (core.es5.js:2688)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKey (core.es5.js:2620)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_.get (core.es5.js:2489)
at resolveNgModuleDep (core.es5.js:9562)
at _createClass (core.es5.js:9605)
at _createProviderInstance$1 (core.es5.js:9573)
at resolveNgModuleDep (core.es5.js:9558)
at injectionError (core.es5.js:1169)
at noProviderError (core.es5.js:1207)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._throwOrNull (core.es5.js:2649)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKeyDefault (core.es5.js:2688)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKey (core.es5.js:2620)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_.get (core.es5.js:2489)
at resolveNgModuleDep (core.es5.js:9562)
at _createClass (core.es5.js:9605)
at _createProviderInstance$1 (core.es5.js:9573)
at resolveNgModuleDep (core.es5.js:9558)
at resolvePromise (zone.js:770)
at resolvePromise (zone.js:741)
at zone.js:818
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:424)
at Object.onInvokeTask (core.es5.js:3924)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (zone.js:191)
at drainMicroTaskQueue (zone.js:584)
at <anonymous>
答案 0 :(得分:0)
尝试在app.module.ts中使用此代码
import { HttpModule } from '@angular/http';
并在导入数组中添加HttpModule
答案 1 :(得分:0)
组件构造函数中提供的DI服务将配置为 providedIn:Root 。如果不是,则需要在app.module(您各自的模块)中将其指定为提供程序。