I am experimenting with Angular2 alpha35, using TypeScript 6.0.0. My index.html loads a headerFooter component. I then added router-outlet tags to it to insert several pages in between. The code at How to change router by typescript in angular2? helped to eliminate several errors, but after many hours of thrashing, I still get a TypeScript error in the @RouteConfig, namely ',' expected. at . . . ( the : right after component), and a Console error of unexpected @ token in the partial page component that it finds (the GET home.js is ok), but cannot load/insert. Here's relevant code. app.ts, index.html, and home.js are all in the same directory.
index.html
<residence-app><h1>Loading . . .</h1></residence-app>
app.ts
/// <reference path="../angular2-oPost/typings/angular2/angular2.d.ts" />
"use strict";
import { Component, View, bootstrap, Directive } from "angular2/angular2";
import { routerInjectables, routerDirectives, Router, RouterOutlet, RouteConfig, RouterLink } from 'angular2/router';
import { Home } from "home";
@Component({
selector: 'residence-app'
})
@View({
directives: [ RouterOutlet, RouterLink, Home ],
templateUrl: "components/navigation/headerFooter.html",
styleUrls: ['commonStyles/headerFooter.css']
})
@RouteConfig( [ {path: '/home', as: component: Home } ] )
// TypeScript error ',' expected. at line 32 col48 ( : right after component), but a , causes 2 other errors
class ResidenceApp {
}
bootstrap( ResidenceApp,
[
routerInjectables
] );
headerFooter.html has several divs and the following tag to insert partial page components
<router-outlet></router-outlet>
home.js is the home page test component to insert in router-outlet in headerFooter.html
"use strict";
import { Component, View, bootstrap, Directive } from "angular2/angular2";
@Component({
//Error loading "home" from "app" at http://localhost/angular2-oPost/app.js
//http://localhost/angular2-oPost/home.js:3:1: Unexpected token @ (WARNING: non-Error used)"
selector: "home"
})
@View({
template: `<h1>Home page under construction</h1>
<a router-link='home'>Home Page</a>`
})
class Home {
}
bootstrap( Home );