2017-10-21 32 views
0

我在AWS上創建了ubuntu服務器的一個實例。除了我沒有完全理解的兩件事之外,所有的東西都可以工作。有路由和響應模式的角4案例

  1. 當你去my web app你只在buttons這是在菜單e.g操作。您無法提出類似'mypage/items'的請求,因爲它會引發HTTP 404 Error。但是,如果你去書籤Home你應該注意到它加入了url後綴/items。但在我app.module每條路由定義:

    `RouterModule.forRoot([ 
          { path: 'items', component: ItemListComponent}, 
          { path: 'guide', component: GuideComponent}, 
          { path: 'history', component: HistoryComponent}, 
          { path: 'sign-up', component: SignUpComponent}, 
          { path: 'login', component: LoginComponent}, 
          { path: '', component: ItemListComponent} 
         ])` 
    

    <ul class="nav navbar-nav"> <li routerLinkActive="active current"><a routerLink="/items">Home</a></li> <li routerLinkActive="active current"><a routerLink="/guide">Poradnik</a></li> <li routerLinkActive="active current"><a routerLink="/history">Historia</a></li> </ul>

  2. 你能提供給我一些提示,我怎樣才能讓我的table這是Home書籤響應?當你切換到移動設備模式時,它不會像goot一樣。

回答

0

您需要爲Web服務器提供一個配置,以將您的所有請求重定向到您的Web應用程序的index.html。請使用以下鏈接作爲參考: https://angular.io/guide/deployment

+0

是的,但它在本地也無法正常工作 – bielas

+0

您在本地如何使用角度4應用程序? – user2842256

+0

'Spring Boot'就在後面 – bielas