Dan*_*son 12 javascript jspm angular
这是完整的错误.
RangeError: Maximum call stack size exceeded
at Injector._instantiate (http://localhost:8000/build.js:36366:63)
at Injector._instantiateProvider (http://localhost:8000/build.js:36244:23)
at Injector._new (http://localhost:8000/build.js:36234:21)
at InjectorInlineStrategy.instantiateProvider (http://localhost:8000/build.js:35998:30)
at ElementDirectiveInlineStrategy.init (http://localhost:8000/build.js:35106:20)
at new AppElement (http://localhost:8000/build.js:34800:24)
at viewFactory_constructor0 (viewFactory_constructor:74:26)
at viewFactory_constructor0 (viewFactory_constructor:76:1)
at viewFactory_constructor0 (viewFactory_constructor:76:1)
at viewFactory_constructor0 (viewFactory_constructor:76:1) <app id="NG2_UPGRADE_0_app_c0">
Run Code Online (Sandbox Code Playgroud)
这是我的源文件.
import 'reflect-metadata'
import {Component} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser'
console.log('Files have started being compiled and infinite loop has begun');
var TodoCmpTest =
Component({
selector: 'todo-cmp'
})
.View({
template: `<h1>TodoCmpTest</h1>`
})
.Class({
constructor: function(){
console.log('hello');
}
});
var AppComponent =
Component({
selector: 'app',
})
.View({
template: `
<div>
<h1> Hello World </h1>
<todo-cmp></todo-cmp>
</div>
`,
directives: [TodoCmpTest]
// directives: []
})
.Class({
constructor: function () {}
});
bootstrap(AppComponent);
Run Code Online (Sandbox Code Playgroud)
它一遍又一遍地重新安装TodoCmpTest.
如果你交换这两行它可以工作,但不加载TodoCmpTest.
directives: [TodoCmpTest]
// directives: []
1. git clone https://github.com/danielrasmuson/Angular2HelloWorld-StackOverflow
2. use node v5.4.0
3. jspm install
4. npm install
5. npm start
看来这是 beta 1 中的 Angular 2 问题,我用 Angular 2 beta 0 尝试了你的存储库,它工作得很好,没有循环。我建议你坚持使用 beta 0,直到他们修复它。我不知道 jspm,所以这是我测试它的方法:(可能不需要这里的所有内容,但只需编辑 package.json -> 删除 -> 并重新安装即可继续为我安装 Angular beta 1 版本)
将 package.json angular2 依赖项编辑为:
"jspm": {
"dependencies": {
"angular2": "npm:angular2@2.0.0-beta.0",
"reflect-metadata": "npm:reflect-metadata@^0.1.3"
},
Run Code Online (Sandbox Code Playgroud)
然后我跑
rm -rf jspm_packages/npm/angular2@2.0.0-beta.1
jspm install npm:angular2@2.0.0-beta.0
npm start
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1551 次 |
最近记录: |