gpt4 book ai didi

javascript - Angular2 : TestApp not working in LightTable. 错误 : UncoatedModuleInstantiator. getUncoatedModule

转载 作者:行者123 更新时间:2023-11-28 07:20:58 25 4
gpt4 key购买 nike

我想玩 Angular2 - 一个非常简单的开始!我只是将一些代码从 angular.io 复制到我的文件中。在 LightTable(集成浏览器)中,此代码不起作用:

<!DOCTYPE html>
<html>
<head>
<title>Angular2 TestApp</title>
<script type="text/javascript" src="./libs/angular2.sfx.dev.js"></script>
<script type="text/javascript" src="./src/main.js"></script>
</head>
<body>
<my-app></my-app>
</body>
</html>

main.js 的 JavaScript:

function AppComponent() {}

AppComponent.annotations = [
new angular.ComponentAnnotation({
selector: 'my-app'
}),
new angular.ViewAnnotation({
template: '<h1>My first Angular 2 App</h1>'
})
];

document.addEventListener('DOMContentLoaded', function() {
document.body.innerHTML += 'Hi'; //for checking, whether the file is recognized
angular.bootstrap(AppComponent);
});

现在在 LightTable(浏览器)中我收到以下错误消息:

Uncaught Error: ModuleEvaluationError: undefined is not a function in traceur-runtime@0.0.88/src/runtime/async.js
angular2.sfx.dev.js [2331] UncoatedModuleInstantiator.getUncoatedModule
angular2.sfx.dev.js [2413] ModuleStore.get
angular2.sfx.dev.js [3187] anonymous
Uncaught ReferenceError: angular is not defined
main.js [5] anonymous

但是在当前的 Firefox 中它工作得很好。我究竟做错了什么?非常感谢!

最佳答案

这个特殊情况是LightTable中的一个问题,应该用0.8.x修复。 In this thread有更多信息和示例项目。

关于javascript - Angular2 : TestApp not working in LightTable. 错误 : UncoatedModuleInstantiator. getUncoatedModule,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30328032/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com