作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想玩 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/
我想玩 Angular2 - 一个非常简单的开始!我只是将一些代码从 angular.io 复制到我的文件中。在 LightTable(集成浏览器)中,此代码不起作用: Angula
我是一名优秀的程序员,十分优秀!