在meteor-angular2 app中,当只有指向'前端的路线时列出,一切正常。如果我添加另一个路由,如下面的代码块所示,我收到以下错误:
Uncaught (in promise) Uncaught SyntaxError: Unexpected token <
Evaluating http://localhost:3000/metis/metis
Error loading http://localhost:3000/client/app
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 {
}
答案 0 :(得分:1)
错误
未捕获(在承诺中)未捕获的SyntaxError:意外的标记&lt;
表示SystemJS无法下载相应的js文件(服务器使用索引HTML页面进行响应)。您的metis
组件导入似乎不正确。应该是(注意“。”在前面):
import {Metis} from "./metis/metis";