【发布时间】:2016-12-18 13:29:09
【问题描述】:
在之前的 rc.4 版本中设置 hashbang #!看起来像这样
bootstrap(ApplicationComponent, [....
{provide: LocationStrategy, useClass: HashLocationStrategy},
{provide: APP_BASE_HREF, useValue: '!'}
]);
现在在 rc.5 中,一切都发生了一点变化,我很难找到一种方法来让相同的地址包含 #!
Angular 文档对设置路由非常清楚,但在描述中略去了 hashbang(https://angular.io/docs/ts/latest/guide/router.html)。单独设置哈希就像在 rc.5 app.routing.ts 中那样完成
export const routing = RouterModule.forRoot(appRoutes, { useHash: true });
但不确定如何另外定义“!”在 rc.5 的 url 中
我不确定它应该如何应用以及以什么形式应用。也许在 boostrap:... 在 app.module 中的@NgModule 中,但到目前为止我还没有让它工作。请提出建议。
【问题讨论】:
标签: angular angular2-routing hashbang