Angular 2 Hosted on IIS: HTTP Error 404

前端 未结 4 1622
北荒
北荒 2020-12-13 07:05

I have simple app with one component that expects certain parameters from url. there is only one route in the application:

const appRoutes: Routes = 
                


        
4条回答
  •  甜味超标
    2020-12-13 07:54

    Modify angular routing by adding # after baseurl:

    http://localhost:4200/yourApp#/subPageRoute

    In app-routing.module.ts on line with RouterModule.forRoot add ", { useHash: true }"

    RouterModule.forRoot(routes, { useHash: true })
    

    This way IIS thinks everything after # is some id on page and ignores it.

提交回复
热议问题