2
我一直在使用javascript來學習Angular2框架的Angular2 quicstart ..我一直在做的就像指南告訴我,但我有一個錯誤Uncaught TypeError:undefined不是一個函數&Uncaught RangeError:最大調用堆棧大小Angular2
Uncaught TypeError: undefined is not a function angular2-all.umd.js:3528
Uncaught RangeError: Maximum call stack size exceeded angular2-polyfills.js:143
我不知道如果我錯過了什麼,這是我的應用程序
- 應用程序的文件結構/
- app.component.js
- boot.js
- node_modules/
- 的index.html
- 的package.json
,這是代碼庫
應用程序。 component.js
(function (app) {
app.AppComponent = ng.core
.Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
.Class({
constructor: function() {
}
});
})(window.app || (window.app == {}));
個
boot.js
(function(app) {
document.addEventListener('DOMContentLoaded', function() {
ng.platform.browser.bootstrap(app.AppComponent);
});
})(window.app || (window.app = {}));
的index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Angular 2</title>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/rxjs/bundles/Rx.umd.js"></script>
<script src="node_modules/angular2/bundles/angular2-all.umd.js"></script>
<script src="app/app.component.js"></script>
<script src="app/boot.js"></script>
</head>
<body>
<my-app>Loading..</my-app>
</body>
</html>
我想我也跟着快速啓動完美,但我不知道在哪裏我錯過了,因爲我是新來Angular2
是的,我做了一個錯字,感謝注意到!不幸的是,雖然沒有解決問題...我仍然得到了錯誤信息 –
真的嗎?因爲我實際測試了你的代碼 - 這就是我對這個錯字的認識。它確實解決了這個問題。 – dfsq
你能分享我的測試代碼嗎?或者瀏覽器版本可能導致此問題? –