Вот полная ошибка.
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">
Вот мой исходный файл.
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);
Повторное восстановление 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