I deploy to netlify using ng build --prod
, and the website works. But when I go to it, it automatically changes the link by adding /home
onto the end. It still works, but then if I refresh the page or click any links to other pages, it doesn't work anymore. The reason the "/home" is added on is because I have a RouterModule
set up that has home as it's initial path. Here is the code I have in my "app.module.ts" that sets up routes:
NgbModule.forRoot(),
RouterModule.forRoot([
{
path: '',
redirectTo: '/home',
pathMatch: 'full'
},
{
path: 'home',
component: HomeComponent
},
{
path: 'terms-and-conditions',
component: TermsAndConditionsComponent
},
{
path: 'privacy',
component: PrivacyPolicyComponent
},
{
path: 'about',
component: AboutComponent
},
{
path: 'contact',
component: ContactComponent
},
{
path: 'team',
component: TeamComponent
},
{
path:'safety',
component: SafetyComponent
}
])
],
providers: [],
bootstrap: [AppComponent]
So why is it that the build doesn't work for the page linking? It just goes to a "404: page not found" and the console has no errors.