我的Angular项目从无法获取开始

时间:2019-02-18 14:51:36

标签: angular visual-studio .net-core iis-express

我正在Visual Studio 2017中构建Angular项目。我有一个用于后端的Dotnet Core Web API。

当我启动两个项目时,Angular项目都会出现404错误。重新加载页面没有任何改变。

当我更改并保存任何打字稿文件上的内容并重新加载页面时,它会收到有角度的页面。

关于IIS吗?我更改了的开始顺序,但没有解决问题。

这是aa.module.ts

import { PaginationComponent } from './shared/pagination.component';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { RouterModule } from '@angular/router';

import { AppComponent } from './app.component';
import { NavMenuComponent } from './nav-menu/nav-menu.component';
import { HomeComponent } from './home/home.component';
import { CounterComponent } from './counter/counter.component';
import { FetchDataComponent } from './fetch-data/fetch-data.component';
import { ModelComponent } from './model/model.component';
import { CustomerComponent } from './customer/customer.component';
import { VehicleFormComponent } from './vehicle-form/vehicle-form.component';
import { VehicleService } from './services/vehicle.service';
import { VehicleListComponent } from './vehicle-list/vehicle-list.component';

@NgModule({
  declarations: [
    AppComponent,
    NavMenuComponent,
    HomeComponent,
    CounterComponent,
    FetchDataComponent,
    ModelComponent,
    CustomerComponent,
    VehicleFormComponent,
    VehicleListComponent,
    PaginationComponent,
  ],
  imports: [
    BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
    HttpClientModule,
    FormsModule,
    RouterModule.forRoot([
      { path: '', component: HomeComponent, pathMatch: 'full' },
      //{ path: '', redirectTo:'vehicles', pathMatch: 'full' },
      { path: 'counter', component: CounterComponent },
      { path: 'fetch-data', component: FetchDataComponent },
      { path: 'model', component: ModelComponent },
      { path: 'customer', component: CustomerComponent },
      { path: 'vehicles', component: VehicleListComponent },
      { path: 'vehicles/new', component: VehicleFormComponent },
      { path: 'vehicles/:id', component: VehicleFormComponent },
    ], { useHash: true })
  ],
  providers: [VehicleService],
  bootstrap: [AppComponent]
})
export class AppModule { }

0 个答案:

没有答案