So, I have been practicing Angular during these days, and I encountered this issue while implementing lazy loading. My video doesn't load; if it does, it is not muted, and after refreshing the webpage, it won't load again.
This is how it is setup in HTML:
<video class="background-video" autoplay loop muted>
<source src="assets/main-page-pc.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
Now, when I created the project, I did not use ng new web-name --no-standalone, so I had to manually create app-routing.module.ts. I have a home component that contains a home.module.ts file and, of course, the contents of the website. I don't use the default app.component for anything.
My app-routing.module.ts looks like this:
const routes: Routes = [
{
path: '',
loadChildren: () => import('./home/home.module').then(m => m.HomeModule) // Lazy loading the home module
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
and home.module.ts like this:
@NgModule({
declarations: [HomeComponent],
imports: [
CommonModule,
RouterModule.forChild([{ path: '', component: HomeComponent }])
]
})
I truly don't have any idea what is going on. The video is in the right location, and it was loading perfectly before adding lazy loading. Also, after implementing that, every time I use ng serve, I get this message:
"Watch mode is enabled. Watching for file changes... NOTE: Raw file sizes do not reflect development server per-request transformations."