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
我沒有看到斜線。我會再檢查一次。 –
我更新了我的答案。 –