我收到此错误。我的angularJS 2应用程序现在很小。我是AngularJS的新手。请帮忙!提前谢谢你。 app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MaterialModule } from '@angular/material';
dashboard.module.ts
import { ToolbarMultirow } from './toolbar-multirow';
import { DashboardComponent } from './dashboard/dashboard.component';
import { DashboardService } from './dashboard/shared/dashboard.service';
import { DashboardModule } from './dashboard/dashboard.module';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
HttpModule,
ReactiveFormsModule,
MaterialModule,
DashboardModule
],
declarations: [
ToolbarMultirow,
// DashboardComponent
],
providers: [
DashboardService
],
bootstrap: [
ToolbarMultirow,
DashboardComponent
],
})
export class AppModule { }
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { HttpModule } from '@angular/http';
import { DashboardComponent } from './dashboard.component';
import { DashboardService } from './shared/dashboard.service';
@NgModule({
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
HttpModule
],
declarations: [
DashboardComponent
],
exports: [
DashboardComponent,
CommonModule,
FormsModule
],
providers: [
// DashboardService
],
bootstrap: [
// DashboardComponent
]
})
export class DashboardModule { }
DashboardComponent_Host.html:1 ERROR CONTEXT DebugContext_ {view: Object,nodeIndex:1,nodeDef:Object,elDef:Object,elView:Object} View_DashboardComponent_Host_0 @ DashboardComponent_Host.html:1 proxyClass @ compiler.es5.js:13572 DebugContext_.logError @ core.es5.js:12953 ErrorHandler.handleError @ core.es5.js:1149 (匿名)@ core.es5.js:4660 ZoneDelegate.invoke @ zone.js:365 onInvoke @ core.es5.js:4125 ZoneDelegate.invoke @ zone.js:364 Zone.run @ zone.js:125(匿名)@ zone.js:760 ZoneDelegate.invokeTask @ zone.js:398 onInvokeTask @ core.es5.js:4116 ZoneDelegate.invokeTask @ zone.js:397 Zone.runTask @ zone.js:165 drainMicroTaskQueue @ zone.js:593 zone.js:569未处理承诺拒绝:没有提供商 路由器! ;区域:;任务:Promise.then;值:错误:否 路由器提供商! 在injectionError(core.es5.js:1231)[有角度] at noProviderError(core.es5.js:1269)[angular] 在ReflectiveInjector _。 throwOrNull(core.es5.js:2770)[angular] 在ReflectiveInjector 。 getByKeyDefault(core.es5.js:2809)[angular] 在ReflectiveInjector 。 getByKey(core.es5.js:2741)[angular] 在ReflectiveInjector .get(core.es5.js:2610)[有角度] at AppModuleInjector.NgModuleInjector.get(core.es5.js:3557)[angular] at resolveDep(core.es5.js:10930)[angular] at createClass(core.es5.js:10799)[angular] 在createDirectiveInstance(core.es5.js:10627)[有角度] 在createViewNodes(core.es5.js:11977)[有角度] at createRootView(core.es5.js:11882)[angular] at callWithDebugContext(core.es5.js:13013)[angular] at Object.debugCreateRootView [as createRootView](core.es5.js:12474)[angular]错误 at injectionError(http://localhost:4200/vendor.bundle.js:2025:86)[angular] at noProviderError(http://localhost:4200/vendor.bundle.js:2063:12)[angular] 在ReflectiveInjector _。 throwOrNull(http://localhost:4200/vendor.bundle.js:3564:19)[angular] 在ReflectiveInjector 。 getByKeyDefault(http://localhost:4200/vendor.bundle.js:3603:25)[angular] 在ReflectiveInjector 。 getByKey(http://localhost:4200/vendor.bundle.js:3535:25)[angular] 在ReflectiveInjector .get(http://localhost:4200/vendor.bundle.js:3404:21)[angular] at AppModuleInjector.NgModuleInjector.get(http://localhost:4200/vendor.bundle.js:4351:52)[angular] at resolveDep(http://localhost:4200/vendor.bundle.js:11724:45)[angular] at createClass(http://localhost:4200/vendor.bundle.js:11593:32)[angular] at createDirectiveInstance(http://localhost:4200/vendor.bundle.js:11421:37)[angular] 在createViewNodes(http://localhost:4200/vendor.bundle.js:12771:49)[angular] at createRootView(http://localhost:4200/vendor.bundle.js:12676:5)[angular] at callWithDebugContext(http://localhost:4200/vendor.bundle.js:13807:42)[angular] at Object.debugCreateRootView [as createRootView](http://localhost:4200/vendor.bundle.js:13268:12)[angular] consoleError @ zone.js:569 handleUnhandledRejection @ zone.js:574 _loop_1 @ zone.js:609 drainMicroTaskQueue @ zone.js:613 zone.js:571错误:未捕获(承诺):错误:没有路由器提供商!错误 在injectionError(core.es5.js:1231)[有角度] at noProviderError(core.es5.js:1269)[angular] 在ReflectiveInjector _。 throwOrNull(core.es5.js:2770)[angular] 在ReflectiveInjector 。 getByKeyDefault(core.es5.js:2809)[angular] 在ReflectiveInjector 。 getByKey(core.es5.js:2741)[angular] 在ReflectiveInjector .get(core.es5.js:2610)[有角度] at AppModuleInjector.NgModuleInjector.get(core.es5.js:3557)[angular] at resolveDep(core.es5.js:10930)[angular] at createClass(core.es5.js:10799)[angular] 在createDirectiveInstance(core.es5.js:10627)[有角度] 在createViewNodes(core.es5.js:11977)[有角度] at createRootView(core.es5.js:11882)[angular] at callWithDebugContext(core.es5.js:13013)[angular] at Object.debugCreateRootView [as createRootView](core.es5.js:12474)[angular] 在injectionError(core.es5.js:1231)[有角度] at noProviderError(core.es5.js:1269)[angular] 在ReflectiveInjector _。 throwOrNull(core.es5.js:2770)[angular] 在ReflectiveInjector 。 getByKeyDefault(core.es5.js:2809)[angular] 在ReflectiveInjector 。 getByKey(core.es5.js:2741)[angular] 在ReflectiveInjector .get(core.es5.js:2610)[有角度] at AppModuleInjector.NgModuleInjector.get(core.es5.js:3557)[angular] at resolveDep(core.es5.js:10930)[angular] at createClass(core.es5.js:10799)[angular] 在createDirectiveInstance(core.es5.js:10627)[有角度] 在createViewNodes(core.es5.js:11977)[有角度] at createRootView(core.es5.js:11882)[angular] at callWithDebugContext(core.es5.js:13013)[angular] at Object.debugCreateRootView [as createRootView](core.es5.js:12474)[angular] at resolvePromise(zone.js:712)[] at:4200 / polyfills.bundle.js:3326:17 [] at:4200 / polyfills.bundle.js:3342:33 [] 在Zone.run(zone.js:125)[=> ] at:4200 / polyfills.bundle.js:3448:57 [] 在Zone.runTask(zone.js:165)[=> ] 在drainMicroTaskQueue(zone.js:593)[] consoleError @ zone.js:571 handleUnhandledRejection @ zone.js:574 _loop_1 @ zone.js:609 drainMicroTaskQueue @ zone.js:613
答案 0 :(得分:1)
只需将RouterModule添加到导入。
Payments.Sum()