So I have been battling to get the router working in Angular2 without using Typescript. I can\'t seem to find any examples, other than some typescript compiled javascript th
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: (
'Hello, World!!!
' +
'' +
'- Index Page
' +
'- Home Page
' +
'
' +
' '
)
})
.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.