没有路由器Angular 4的提供商

时间:2018-02-22 11:16:59

标签: javascript angular angular-router angular-providers

我正在开发一个角度应用程序,我在项目中的任何地方都没有使用Routes但是我的web开发工具中出现了这个错误:

ERROR Error: No provider for Router!
Trace de la pile :
injectionError@webpack-internal:///../../../core/@angular/core.es5.js:1369:90
noProviderError@webpack-internal:///../../../core/@angular/core.es5.js:1407:12
ReflectiveInjector_.prototype._throwOrNull@webpack-internal:///../../../core/@angular/core.es5.js:2849:19
ReflectiveInjector_.prototype._getByKeyDefault@webpack-internal:///../../../core/@angular/core.es5.js:2888:20
ReflectiveInjector_.prototype._getByKey@webpack-internal:///../../../core/@angular/core.es5.js:2820:20
...
...
resolveNgModuleDep@webpack-internal:///../../../core/@angular/core.es5.js:9688:17
_createClass@webpack-internal:///../../../core/@angular/core.es5.js:9729:29
_createProviderInstance$1@webpack-internal:///../../../core/@angular/core.es5.js:9703:26
resolveNgModuleDep@webpack-internal:///../../../core/@angular/core.es5.js:9688:17
_createClass@webpack-internal:///../../../core/@angular/core.es5.js:9729:29
_createProviderInstance$1@webpack-internal:///../../../core/@angular/core.es5.js:9703:26
resolveNgModuleDep@webpack-internal:///../../../core/@angular/core.es5.js:9688:17
NgModuleRef_.prototype.get@webpack-internal:///../../../core/@angular/core.es5.js:10762:16
resolveDep@webpack-internal:///../../../core/@angular/core.es5.js:11250:12
createClass@webpack-internal:///../../../core/@angular/core.es5.js:11114:85
createDirectiveInstance@webpack-internal:///../../../core/@angular/core.es5.js:10951:37
createViewNodes@webpack-internal:///../../../core/@angular/core.es5.js:12392:53
callViewAction@webpack-internal:///../../../core/@angular/core.es5.js:12822:13
execComponentViewsAction@webpack-internal:///../../../core/@angular/core.es5.js:12731:13
createViewNodes@webpack-internal:///../../../core/@angular/core.es5.js:12420:5
createRootView@webpack-internal:///../../../core/@angular/core.es5.js:12282:5
callWithDebugContext@webpack-internal:///../../../core/@angular/core.es5.js:13667:39
debugCreateRootView@webpack-internal:///../../../core/@angular/core.es5.js:12971:12
ComponentFactory_.prototype.create@webpack-internal:///../../../core/@angular/core.es5.js:10061:37
ComponentFactoryBoundToModule.prototype.create@webpack-internal:///../../../core/@angular/core.es5.js:3533:16
ApplicationRef_.prototype.bootstrap@webpack-internal:///../../../core/@angular/core.es5.js:4968:40
PlatformRef_.prototype._moduleDoBootstrap/<@webpack-internal:///../../../core/@angular/core.es5.js:4746:74
PlatformRef_.prototype._moduleDoBootstrap@webpack-internal:///../../../core/@angular/core.es5.js:4746:13
PlatformRef_.prototype._bootstrapModuleFactoryWithZone/</</<@webpack-internal:///../../../core/@angular/core.es5.js:4708:21
ZoneDelegate.prototype.invoke@webpack-internal:///../../../../zone.js/dist/zone.js:388:17
forkInnerZoneWithAngularBehavior/zone._inner<.onInvoke@webpack-internal:///../../../core/@angular/core.es5.js:4090:24
ZoneDelegate.prototype.invoke@webpack-internal:///../../../../zone.js/dist/zone.js:387:17
Zone.prototype.run@webpack-internal:///../../../../zone.js/dist/zone.js:138:24
scheduleResolveOrReject/<@webpack-internal:///../../../../zone.js/dist/zone.js:858:52
ZoneDelegate.prototype.invokeTask@webpack-internal:///../../../../zone.js/dist/zone.js:421:17
forkInnerZoneWithAngularBehavior/zone._inner<.onInvokeTask@webpack-internal:///../../../core/@angular/core.es5.js:4081:24
ZoneDelegate.prototype.invokeTask@webpack-internal:///../../../../zone.js/dist/zone.js:420:17
Zone.prototype.runTask@webpack-internal:///../../../../zone.js/dist/zone.js:188:28
drainMicroTaskQueue@webpack-internal:///../../../../zone.js/dist/zone.js:595:25
  AppComponent.ngfactory.js:9:80

在终端中,项目正在编译正确。

ng -v给出了这一点。

Angular CLI: 1.6.8
Node: 6.3.0
OS: win32 x64
Angular: 4.4.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... tsc-wrapped

@angular/cli: 1.6.8
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0

昨天它正在运行,主要区别在于我添加了一些抽象类,服务和Http请求

0 个答案:

没有答案