2017-08-14 12 views
-2

私は角度のプロジェクトで次のルーティングを持っている:Angular4ルーティング方法

const sampleRoutes: Routes = [ 
    { 
    path: ':fruit/show', 
    }, 
    { 
    path: ':fruit/edit' 
    }, 
    { 
    path: ':fruit/update' 
    } 
]; 

と私はこのような形式にそれを変更したい:

const sampleRoutes: Routes = [ 
    { 
    path: ':fruit/', 
    children: [ 
     { 
     path: 'show' 
     }, 
     { 
     path: 'edit' 
     }, 
     { 
     path: 'update' 
     } 
    ] 
    } 
]; 

しかし、角度が上記のルーティングをキャッチすることはできません。誰もがこのように構成する方法を知っていますか?どんな助けでも大変感謝しています。あなたの情報については

+0

「angularjs4」のようなものはありません。 –

答えて

0

、 正しいルーティングは次のようにする必要があります:

const sampleRoutes: Routes = [ 
    { 
    path: ':fruit', 
    children: [ 
     { 
     path: 'show' 
     }, 
     { 
     path: 'edit' 
     }, 
     { 
     path: 'update' 
     } 
    ] 
    } 
]; 

:fruitが正しいルーティングを取得します後/を削除します。

関連する問題