2017-02-06 7 views
0

http://myapplication/unmanagedに行きますが、404エラーが発生します。私はこれを動作させるには、use hashをtrueに設定し、urlにハッシュタグを付けるようにします。しかし、私は実行時にクエリ文字列パラメータを渡そうとしているので、ハッシュタグがそれを上げてしまうので、私はそれを行うことができません。ハッシュを使用せずにアプリケーションのロード時に次のURLを使用する方法はありますか?角度2アクセスビュー

URL:

http://myapplication/unmanaged/x14/3?mac=00:11:22:33:44:79

ルート:

const routes: Routes = [ 
    { 
    path: '', 
    component: StartPage 
    }, 
    { 
    path: 'unmanaged/:controllerId/:activeGroupId', 
    component: UnmanagedPage 
    }, 
    { 
    path: 'edge', 
    component: EdgeComponent, 
    canActivate: [AuthGuard], 
    children: [ 
     { path: '', component: DevicesPage, pathMatch: 'full' }, 
     { path: 'devices', component: DevicesPage }, 
     { path: 'device/:id', component: DeviceDetailsPage }, 
     { path: 'device-edit/:id', component: DeviceEditPage}, 
     { path: 'device-add', component: DeviceAddPage }, 

     { path: 'groups', component: GroupsPage }, 

     { path: 'cyber-score', component: CyberScorePage }, 
     { path: 'profile', component: ProfilePage }, 
     { path: 'profile-edit', component: ProfileEditPage } 
    ] 
    }, 
    { 
    path: 'guest', 
    component: GuestComponent, 
    children: [ 
     { path: 'device', component: GuestDeviceDetailsPage } 
    ] 
    }, 
    { 
    path: '**', 
    component: PageNotFoundPage 
    } 
]; 

答えて

0

あなたはPathLocationStrategyでディープリンクを使用すると、ブラウザが上の管理対象外という名前のリソースを検索しようと入力するとサーバー。そのため、サーバー上にこのようなリソースは存在しないため、404が取得されます。サーバーのリダイレクトを構成して、未知のリソースをアプリケーションのindex.htmlにリダイレクトする必要があります。次に、Angular RouterがURLを解析し、ビュー。リダイレクトの設定については、サーバーのドキュメントを参照してください。

URLにハッシュがあると、ブラウザはハッシュ後のものがクライアントのナビゲーション用であり、サーバーにヒットしていないことを知っています。