Here is the full error.
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">
Here is my source file.
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);
Its reinstatiating TodoCmpTest over and over again.
If you swap these two lines it works, but doesn't load 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
It seems it's an angular 2 problem in the beta 1, I tried your repo with angular 2 beta 0 and it worked fine, no loop. I suggest you stick with beta 0, until they fix it. I don't know jspm, so here is what i did to test it: (not everything here might be needed but just editing package.json -> removing -> and reinstalling kept installing me the angular beta 1 version)
edited the package.json angular2 dependency to:
"jspm": {
"dependencies": {
"angular2": "npm:[email protected]",
"reflect-metadata": "npm:reflect-metadata@^0.1.3"
},
then i run
rm -rf jspm_packages/npm/[email protected]
jspm install npm:[email protected]
npm start
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With