You can use router.config()
method to specify list of routes. Here is an example written purely in ES5 (see this plunk):
var App = Component({
selector: 'my-app',
directives: [RouterOutlet, RouterLink],
template: (
'<h2>Hello, World!!!</h2>' +
'<ul>' +
'<li><a [router-link]="[\'./Index\']">Index Page</a></li>' +
'<li><a [router-link]="[\'./Home\']">Home Page</a></li>' +
'</ul>' +
'<router-outlet></router-outlet>'
)
})
.Class({
constructor: function(router) {
router.config([
{ path: '/index': component: Index, name: 'Index' },
{ path: '/home': component: Home, name: 'Home' }
])
}
});
App.parameters = [Router];
PS Decorators are part of ES2016
(formerly ES7). They're javascript and supported by Babel
. I think you should not be afraid to use them.