我在angular4的网址中遇到了问题:
上车
未找到在此处找不到请求的URL /个人资料/主页 服务器
此外,尝试时遇到404 Not Found错误 使用ErrorDocument来处理请求。
我的app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import {AppRoutingModule} from './app-routing.module';
import { HashLocationStrategy, LocationStrategy, PathLocationStrategy } from '@angular/common';
import { ImageUploadModule } from 'angular2-image-upload';
import { AppComponent } from './app.component';
import { NavbarComponent } from './navbar/navbar.component';
import { HomeComponent } from './home/home.component';
import { AddComponent } from './add/add.component';
import { EditComponent } from './edit/edit.component';
import { ProfileService } from './services/profile.service'
import { MessageService } from './services/message.service'
@NgModule({
declarations: [
AppComponent,
NavbarComponent,
HomeComponent,
AddComponent,
EditComponent
],
imports: [
BrowserModule,
AppRoutingModule,
FormsModule,
ImageUploadModule.forRoot(),
],
providers: [ProfileService, MessageService,{provide: LocationStrategy, useClass: PathLocationStrategy}],
bootstrap: [AppComponent]
})
export class AppModule { }