【发布时间】:2016-06-04 17:16:11
【问题描述】:
我正在尝试解决刷新 Angular2 页面导致 404 错误的问题。当我尝试实现 HashLocationStrategy 时,它似乎对生成的 URL 没有任何影响。
我的 main.ts 文件是:
import { bootstrap } from '@angular/platform-browser-dynamic';
import { provide } from '@angular/core';
import { AppComponent } from './app.component';
import { ROUTER_PROVIDERS } from '@angular/router';
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
bootstrap(AppComponent, [
ROUTER_PROVIDERS,
provide(LocationStrategy, {useClass: HashLocationStrategy})
]);
【问题讨论】:
标签: angular