Angular2 rc3中的HashLocationStrategy无法正常工作
import {provide} from '@angular/core';
import {LocationStrategy, HashLocationStrategy} from '@angular/common';
...
bootstrap(AppComponent, [
disableDeprecatedForms(),
provideForms(),
provide(LocationStrategy, { useClass: HashLocationStrategy }),
APP_ROUTER_PROVIDERS
]);
但链接是在没有#的情况下生成的 我想使用新的路由器(" @ angular / router":" 3.0.0-alpha.7")
答案 0 :(得分:0)
尝试使用以下配置:
bootstrap(AppComponent, [
disableDeprecatedForms(),
provideForms(),
{provide: LocationStrategy, useClass: HashLocationStrategy},
APP_ROUTER_PROVIDERS
]);