错误:无法匹配任何路由。网址细分:'hotelier / auth'

时间:2018-04-06 09:35:29

标签: angular routes

我有角度路线的问题。当我第一次在新选项卡中运行项目时,浏览器会返回错误:

  

未捕获(承诺):错误:无法匹配任何路线。网址细分:'hotelier / auth'

但是,如果我刷新标签,它就可以正常工作,我在项目中最有趣的事情就是这个标签'hotelier / auth'我只有'admin / AUTH

const appRoutes: Routes = [
  { path: '', redirectTo: '/admin/auth', pathMatch: 'full' },
  { path: 'admin', component: AppComponent, children: [
    { path: 'auth', component: AuthComponent },
    { path: '', component: MainComponent, children: [
      { path: 'home', component: HomeComponent },
      { path: 'countries', component: CountriesComponent },
      { path: 'cities', component: CitiesComponent },
      { path: 'applications', component: ApplicationsComponent },
      { path: 'services-groups', component: ServicesGroupsComponent },
      { path: 'services', component: ServicesComponent },
      { path: 'facilities', component: FacilitiesComponent },
      { path: 'beds', component: BedsComponent },
      { path: 'property-types', component: PropertyTypesComponent },
      { path: 'personal-languages', component: PersonalLanguagesComponent },
      { path: 'properties', component: PropertiesComponent },
      { path: 'properties/add', component: AddPropertyComponent },
      { path: 'properties/:id/edit', component: EditPropertyComponent },
      { path: 'properties/:id/add-room-type', component: 
         AddNewRoomTypeComponent },
      { path: 'properties/:id/edit-room-type/:id', component: 
         EditRoomTypeComponent },
      { path: '**', redirectTo: '/admin/home' }
    ] }
  ] }
];

0 个答案:

没有答案