I wrote a simple Angular 2 application. Everything works just fine except one thing. When I click on the router link, Url is changed and component is loaded, then when I reload the page I get 404 not found. Can not understand why?
Here is my code:
(function(app) {
app.AppComponent =
ng.core.Component({
selector: 'my-app',
template: '<a [routerLink]="[\'Component1\']">Component1</a>' +
'<a [routerLink]="[\'Component2\']">Component2</a>' +
'<router-outlet></router-outlet>',
directives: [
ng.router.ROUTER_DIRECTIVES
]
})
.Class({
constructor: function() {}
});
app.AppComponent = ng.router.RouteConfig([
{
path: '/component1', component: app.Component1, name: 'Component1'
},
{
path: '/component2', component: app.Component2, name: 'Component2'
}
]) ( app.AppComponent );
})(window.app || (window.app = {}));
Any help will be appreciated!