pkozlowski-opensource / ng2-play

A minimal Angular2 playground using TypeScript and SystemJS loader
535 stars 229 forks source link

Error when using @Query #26

Open 0x-r4bbit opened 9 years ago

0x-r4bbit commented 9 years ago

Hey @pkozlowski-opensource

it's actually not the first time I ran into this with this setup. Whenever I use @Query traceur throws.

Here's a snippet of my code:

@Component({ ... })
@View({ ... })
class InnerWidget { }

@Component({ ... })
@View({ ... })
class Widget {
  constructor(@Query(InnerWidget) query:QueryList<InnerWidget>) {

  }
}

@Component({...}}
@View({
  template: `
    <widget>
      <inner-widget><inner-widget>
    </widget>
  `,
  directives: [Widget, InnerWidget]
})
class App {

}

Here's the (not so helpful error):

EXCEPTION: TypeError: Cannot read property '__$511015796$4$__' of undefined
angular2.js:18939 STACKTRACE:
angular2.js:18939 TypeError: Cannot read property '__$511015796$4$__' of undefined
    at Object.getOwnHashObject (traceur-runtime.js:185)
    at Object.genericType (traceur-runtime.js:1414)
    at Function.execute.Object.defineProperty.get (hello.js:36)
    at ReflectionCapabilities.execute.ReflectionCapabilities.parameters (angular2.js:5329)
    at Reflector.execute.Reflector.parameters (angular2.js:5138)
    at _dependenciesFor (angular2.js:23474)
    at execute.Binding.resolve (angular2.js:23614)
    at Function.execute.DirectiveBinding.createFromBinding (angular2.js:26005)
    at Function.execute.DirectiveBinding.createFromType (angular2.js:26039)
    at execute.Compiler._bindDirective (angular2.js:27837)
localhost/:1 Uncaught (in promise) TypeError: Cannot read property '__$511015796$4$__' of undefined
    at Object.getOwnHashObject (http://localhost:9000/lib/traceur-runtime.js:185:30)
    at Object.genericType (http://localhost:9000/lib/traceur-runtime.js:1414:31)
    at Function.execute.Object.defineProperty.get (http://localhost:9000/hello.js:36:36)
    at ReflectionCapabilities.execute.ReflectionCapabilities.parameters (http://localhost:9000/lib/angular2.js:5329:37)
    at Reflector.execute.Reflector.parameters (http://localhost:9000/lib/angular2.js:5138:50)
    at _dependenciesFor (http://localhost:9000/lib/angular2.js:23474:28)
    at execute.Binding.resolve (http://localhost:9000/lib/angular2.js:23614:28)
    at Function.execute.DirectiveBinding.createFromBinding (http://localhost:9000/lib/angular2.js:26005:30)
    at Function.execute.DirectiveBinding.createFromType (http://localhost:9000/lib/angular2.js:26039:37)
    at execute.Compiler._bindDirective (http://localhost:9000/lib/angular2.js:27837:37)getOwnHashObject @ traceur-runtime.js:185genericType @ traceur-runtime.js:1414execute.Object.defineProperty.get @ hello.js:36execute.ReflectionCapabilities.parameters @ angular2.js:5329execute.Reflector.parameters @ angular2.js:5138_dependenciesFor @ angular2.js:23474execute.Binding.resolve @ angular2.js:23614execute.DirectiveBinding.createFromBinding @ angular2.js:26005execute.DirectiveBinding.createFromType @ angular2.js:26039execute.Compiler._bindDirective @ angular2.js:27837(anonymous function) @ angular2.js:27884execute.ListWrapper.map @ angular2.js:4907execute.Compiler._compile @ angular2.js:27883(anonymous function) @ angular2.js:27928(anonymous function) @ angular2.js:27913execute.Compiler._compileNestedProtoViews @ angular2.js:27912(anonymous function) @ angular2.js:27854run @ zone.js:113execute.NgZone._createInnerZone.zone.fork.fork.$run @ angular2.js:12928zoneBoundFn @ zone.js:86
angular2.js:28169 Uncaught (in promise) TypeError: Cannot read property '__$511015796$4$__' of undefined
    at Object.getOwnHashObject (http://localhost:9000/lib/traceur-runtime.js:185:30)
    at Object.genericType (http://localhost:9000/lib/traceur-runtime.js:1414:31)
    at Function.execute.Object.defineProperty.get (http://localhost:9000/hello.js:36:36)
    at ReflectionCapabilities.execute.ReflectionCapabilities.parameters (http://localhost:9000/lib/angular2.js:5329:37)
    at Reflector.execute.Reflector.parameters (http://localhost:9000/lib/angular2.js:5138:50)
    at _dependenciesFor (http://localhost:9000/lib/angular2.js:23474:28)
    at execute.Binding.resolve (http://localhost:9000/lib/angular2.js:23614:28)
    at Function.execute.DirectiveBinding.createFromBinding (http://localhost:9000/lib/angular2.js:26005:30)
    at Function.execute.DirectiveBinding.createFromType (http://localhost:9000/lib/angular2.js:26039:37)
    at execute.Compiler._bindDirective (http://localhost:9000/lib/angular2.js:27837:37)
0x-r4bbit commented 9 years ago

Updated this one to alpha.35 too. Basically same error + some more:

EXCEPTION: TypeError: Cannot read property '__$56391968$4$__' of undefined
angular2.js:21809 STACKTRACE:
angular2.js:21809 TypeError: Cannot read property '__$56391968$4$__' of undefined
    at Object.getOwnHashObject (traceur-runtime.js:185)
    at Object.genericType (traceur-runtime.js:1414)
    at Function.execute.Object.defineProperty.get (hello.js:36)
    at ReflectionCapabilities.execute.ReflectionCapabilities.parameters (angular2.js:8358)
    at Reflector.execute.Reflector.parameters (angular2.js:8167)
    at _dependenciesFor (angular2.js:25237)
    at execute.Binding.resolve (angular2.js:25375)
    at Function.execute.DirectiveBinding.createFromBinding (angular2.js:27645)
    at Function.execute.DirectiveBinding.createFromType (angular2.js:27679)
    at execute.Compiler._bindDirective (angular2.js:28921)
angular2.js:21813 EXCEPTION: TypeError: Cannot read property 'ref' of undefined
angular2.js:21809 STACKTRACE:
angular2.js:21809 TypeError: Cannot read property 'ref' of undefined
    at angular2.js:28950
    at Zone.run (angular2.js:118)
    at Zone.execute.NgZone._createInnerZone.zone.fork.fork.$run [as run] (angular2.js:15745)
    at zoneBoundFn (angular2.js:91)
    at lib$es6$promise$$internal$$tryCatch (angular2.js:1341)
    at lib$es6$promise$$internal$$invokeCallback (angular2.js:1353)
    at lib$es6$promise$$internal$$publish (angular2.js:1324)
    at angular2.js:169
    at execute.NgZone._createInnerZone.zone.fork.fork.$scheduleMicrotask.microtask (angular2.js:15771)
    at Zone.run (angular2.js:118)
angular2.js:21813 EXCEPTION: TypeError: Cannot read property 'elementBinders' of null
angular2.js:21809 STACKTRACE:
angular2.js:21809 TypeError: Cannot read property 'elementBinders' of null
    at execute.AppViewManager.createRootHostView (angular2.js:25793)
    at angular2.js:16411
    at Zone.run (angular2.js:118)
    at Zone.execute.NgZone._createInnerZone.zone.fork.fork.$run [as run] (angular2.js:15745)
    at zoneBoundFn (angular2.js:91)
    at lib$es6$promise$$internal$$tryCatch (angular2.js:1341)
    at lib$es6$promise$$internal$$invokeCallback (angular2.js:1353)
    at lib$es6$promise$$internal$$publish (angular2.js:1324)
    at angular2.js:169
    at execute.NgZone._createInnerZone.zone.fork.fork.$scheduleMicrotask.microtask (angular2.js:15771)
angular2.js:21813 EXCEPTION: TypeError: Cannot read property 'location' of undefined
angular2.js:21809 STACKTRACE:
angular2.js:21809 TypeError: Cannot read property 'location' of undefined
    at angular2.js:29571
    at Zone.run (angular2.js:118)
    at Zone.execute.NgZone._createInnerZone.zone.fork.fork.$run [as run] (angular2.js:15745)
    at zoneBoundFn (angular2.js:91)
    at lib$es6$promise$$internal$$tryCatch (angular2.js:1341)
    at lib$es6$promise$$internal$$invokeCallback (angular2.js:1353)
    at lib$es6$promise$$internal$$publish (angular2.js:1324)
    at angular2.js:169
    at execute.NgZone._createInnerZone.zone.fork.fork.$scheduleMicrotask.microtask (angular2.js:15771)
    at Zone.run (angular2.js:118)
angular2.js:21813 EXCEPTION: TypeError: Cannot read property 'hostView' of undefined
angular2.js:21809 STACKTRACE:
angular2.js:21809 TypeError: Cannot read property 'hostView' of undefined
    at zone.run.tick (angular2.js:29604)
    at Zone.run (angular2.js:118)
    at Zone.execute.NgZone._createInnerZone.zone.fork.fork.$run [as run] (angular2.js:15745)
    at zoneBoundFn (angular2.js:91)
    at lib$es6$promise$$internal$$tryCatch (angular2.js:1341)
    at lib$es6$promise$$internal$$invokeCallback (angular2.js:1353)
    at lib$es6$promise$$internal$$publish (angular2.js:1324)
    at angular2.js:169
    at execute.NgZone._createInnerZone.zone.fork.fork.$scheduleMicrotask.microtask (angular2.js:15771)
    at Zone.run (angular2.js:118)

FYI