找不到模块main-server.js

时间:2017-11-04 02:05:21

标签: angular angular2-template asp-net-core-spa-services

我创建了一个新的角度组件后出现此错误,创建后我在app.module.shared.ts上定义了它:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';

import { AppComponent } from './components/app/app.component';
import { NavMenuComponent } from './components/navmenu/navmenu.component';
import { HomeComponent } from './components/home/home.component';
import { HistoryGridComponent } from "./components/history/histories-grid.component";

@NgModule({
    declarations: [
        AppComponent,
        NavMenuComponent,
        HomeComponent,
        HistoryGridComponent
    ],
    imports: [
        CommonModule,
        HttpModule,
        ReactiveFormsModule,
        RouterModule.forRoot([
            { path: '', redirectTo: 'home', pathMatch: 'full' },
            { path: 'home', component: HomeComponent },
            { path: 'history', component: HistoryGridComponent },
            { path: '**', redirectTo: 'home' }
        ])
    ]
})
export class AppModuleShared {
}

并尝试运行,但它始终返回以下错误:

Error

有关正在发生的事情的任何想法?

1 个答案:

答案 0 :(得分:0)

我认为您在history-grid文件夹中删除了history-grid.component.html。如果你这样做,删除" templateUrl"历史组件的@Component中的属性.ts enter image description here

相关问题