I'm facing an issue with my angular 2 typescript app component routes not working properly.
Whenever I try to change the route to login in the address bar, it fails to load the corresponding HTML content. Strangely, there are no console errors displayed either.
Below is a snippet of the code from my app component:
import { Component } from 'angular2/core';
import { RouteConfig, ROUTER_DIRECTIVES } from 'angular2/router';
import {Login} from './components/login/login';
import {Home} from './components/home/home';
@Component({
selector: 'my-app',
template: `
<ul>
<li>test</li>
</ul>
`
directives: [ROUTER_DIRECTIVES]
})
@RouteConfig([
{ path: '/', component: Home, as: 'Home'},
{ path: '/home', component: Home, as: 'Home'},
{ path: '/login', component: Login, as: 'Login' }
])
export class AppComponent {}
Index
<html>
... (content omitted for brevity)
This is my boot file
import {bootstrap} from 'angular2/platform/browser';
import {HTTP_PROVIDERS} from 'angular2/http';
... (content omitted for brevity)
]);
This is my config file:
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/boot')
.then(null, console.error.bind(console));