I deployed my Angular2 app on server as a Docker image, where it's served by NginX.
But something strange happend. When i ran my webpack-dev-server locally, to check if it builds ok, i get expected view
Where root component contains description and links, and second one contains "Top Posts" and other stuff.
Then, I packed it up into Docker image with NginX and served on the server. But instead of view above I got this
Console shows nothing.
What might be the cause of problems with loading subcomponents? Configuration below.
index.html
<html>
<head>
<base href="/">
<title>Zielony</title>
<meta charset="utf-8">
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en"></script>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit"></script>
</head>
<body>
<my-app>Loading...</my-app>
</body>
<script src="/app.js"></script>
</html>
boot.ts
export const routes: RouterConfig = [
{
path: '',
redirectTo: 'dashboard',
pathMatch: 'full'
},
{
path: 'posts',
component: PostsComponent,
canActivate: [LoggedInGuard]
},
{
path: 'dashboard',
component: PostsDashboardComponent
},
{
path: 'posts/:id',
component: PostDetailComponent
},
{ path: 'login',
component: LoginComponent
},
{ path: 'signup',
component: SignUpComponent
},
];
bootstrap(AppComponent, [
HTTP_PROVIDERS,
provideRouter(routes),
disableDeprecatedForms(),
provideForms(),
LoggedInGuard,
{ provide: APP_CONFIG, useValue: POSTS_CONFIG },
UserService,
PostService
]);
app.component.ts
@Component({
selector: 'my-app',
template: `
<h1>My First Zielony Angular 2 App</h1>
<nav>
<a routerLink="/dashboard" routerLinkActive="active">Post Dashboard</a>
<a routerLink="/posts" routerLinkActive="active">Posts</a>
</nav>
<router-outlet></router-outlet>
`,
styles: [some_css_here,],
directives: [ROUTER_DIRECTIVES,]
})
export class AppComponent {
}
Ask if You want more