以角度2设置路线

时间:2016-07-04 08:38:27

标签: javascript angularjs angular

我正在尝试设置路线,以便在我点击http://localhost:8080/user/beta/时,它会重定向到http://localhost:8080/user/beta/#spreadsheet,  并显示电子表格视图,但我的代码重定向到:http://localhost:8080/#spreadsheet

import { provideRouter, RouterConfig } from '@angular/router';

import {Spreadsheet} from './components/spreadsheet/spreadsheet.component';

const routes: RouterConfig = [
  { path: '', redirectTo: 'spreadsheet', terminal: true },
  { path: 'spreadsheet', component: Spreadsheet }
];

export const APP_ROUTER_PROVIDERS = [
  provideRouter(routes)
];

1 个答案:

答案 0 :(得分:1)

MaybeHashLocationStrategy一起使用,以定义网址的哪一部分是静态的。