2
以下路由配置有什么问题?即使有路线app/jungle
,我也总是导航到**
。角路由器3通配符匹配
import {bootstrap} from '@angular/platform-browser-dynamic';
import { RouterConfig, provideRouter } from '@angular/[email protected]'
import {App} from './app';
import { HomeComponent } from './home.component';
import { JungleComponent } from './jungle.component';
import { NotFoundComponent } from './not-found.component';
const APP_ROUTES: RouterConfig = [
{
path: '', pathMatch: '', redirectTo: 'app/home'
},
{
path: 'app/', pathMatch: '', redirectTo: 'app/home'
},
{
path: 'app/home', component: HomeComponent
},
{
path: 'app/jungle', component: JungleComponent
},
{
path: '**', component: NotFoundComponent
}
]
bootstrap(App, [provideRouter(APP_ROUTES)])
.catch(err => console.error(err));
Here是一个笨蛋。 我使用@角/路由器@ 3.0.0-beta.2
哇,这实际上解决了这个问题,但如果我改变了'{ 道: '应用程序/',pathMatch: '全',redirectTo: '应用程序/家' }'来'{ 路径:'app',pathMatch:'full',redirectTo:'app/home' }(**注意路径属性**末尾的反斜杠)给出了和以前相同的问题。任何线索 – Lekhnath
我没有看到斜线。我会再检查一次。 –
我更新了我的答案。 –