我正在尝试设置路线,以便在我点击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)
];
答案 0 :(得分:1)
将Maybe
与HashLocationStrategy
一起使用,以定义网址的哪一部分是静态的。