在meteor-angular2 应用程序中,当仅列出指向“前端”的路线时,一切正常。如果我添加另一条路线,如以下代码块所示,我会收到以下错误:
Uncaught (in promise) Uncaught SyntaxError: Unexpected token <
Evaluating http://localhost:3000/metis/metis
Error loading http://localhost:3000/client/app
应用程序.ts
import {Component, View, provide} from 'angular2/core';
import {ROUTER_PROVIDERS, ROUTER_DIRECTIVES, RouteConfig, APP_BASE_HREF} from 'angular2/router';
import {bootstrap} from 'angular2-meteor';
import {Frontend} from "./frontend/frontend";
import {Metis} from "metis/metis";
@Component({
selector: 'app',
template:'<router-outlet></router-outlet>',
directives:[ROUTER_DIRECTIVES]
})
@RouteConfig([
{ path: '/', name: 'Frontend', component: Frontend },
{ path: '/metis', name: 'Metis', component: Metis }
])
class HATViz {}
bootstrap(HATViz, [
ROUTER_PROVIDERS,
provide(APP_BASE_HREF, { useValue: '/' })
]);
Metis 组件如下所示:
import {Component, OnInit} from 'angular2/core';
@Component({
templateUrl:'client/metis/metis.html',
selector:'metis'
})
export class Metis {
}