Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

ElementRef in constructor is undefined after upgrading to 0.7.5 #602

Description

@nickwph

After upgrading to zone.js 0.7.5, ElementRef of a component is no longer being injected.

constructor(private elementRef: ElementRef) {
    // elementRef is undefined
}
EXCEPTION: Uncaught (in promise): TypeError: Cannot read property 'nativeElement' of undefined
TypeError: Cannot read property 'nativeElement' of undefined
Unhandled Promise rejection: Cannot read property 'nativeElement' of undefined ; Zone: angular ; Task: Promise.then ; Value: TypeError: Cannot read property 'nativeElement' of undefined
    at RadioComponent.CheckboxComponent (http://localhost:3000/main.bundle.js:15686:42)
    at new RadioComponent (http://localhost:3000/main.bundle.js:19857:43)
    at new Wrapper_RadioComponent (/RadioModule/RadioComponent/wrapper.ngfactory.js:6:18)
    at CompiledTemplate.proxyViewClass.View_RadioDemoComponent0.createInternal (/RadioDemoModule/RadioDemoComponent/component.ngfactory.js:177:31)
    at CompiledTemplate.proxyViewClass.AppView.create (http://localhost:3000/vendor.bundle.js:12403:26)
    at CompiledTemplate.proxyViewClass.View_RadioDemoComponent_Host0.createInternal (/RadioDemoModule/RadioDemoComponent/host.ngfactory.js:15:19)
    at CompiledTemplate.proxyViewClass.AppView.createHostView (http://localhost:3000/vendor.bundle.js:12416:26)
    at ComponentFactory.create (http://localhost:3000/vendor.bundle.js:7840:30)
    at ViewContainerRef_.createComponent (http://localhost:3000/vendor.bundle.js:9699:67)
    at RouterOutlet.activate (http://localhost:3000/vendor.bundle.js:29593:43)
    at ActivateRoutes.placeComponentIntoOutlet (http://localhost:3000/vendor.bundle.js:28903:19)
    at ActivateRoutes.activateRoutes (http://localhost:3000/vendor.bundle.js:28870:29)
    at http://localhost:3000/vendor.bundle.js:28806:61
    at Array.forEach (native)
    at ActivateRoutes.activateChildRoutes (http://localhost:3000/vendor.bundle.js:28806:32) TypeError: Cannot read property 'nativeElement' of undefined
    at RadioComponent.CheckboxComponent (http://localhost:3000/main.bundle.js:15686:42)
    at new RadioComponent (http://localhost:3000/main.bundle.js:19857:43)
    at new Wrapper_RadioComponent (/RadioModule/RadioComponent/wrapper.ngfactory.js:6:18)
    at CompiledTemplate.proxyViewClass.View_RadioDemoComponent0.createInternal (/RadioDemoModule/RadioDemoComponent/component.ngfactory.js:177:31)
    at CompiledTemplate.proxyViewClass.AppView.create (http://localhost:3000/vendor.bundle.js:12403:26)
    at CompiledTemplate.proxyViewClass.View_RadioDemoComponent_Host0.createInternal (/RadioDemoModule/RadioDemoComponent/host.ngfactory.js:15:19)
    at CompiledTemplate.proxyViewClass.AppView.createHostView (http://localhost:3000/vendor.bundle.js:12416:26)
    at ComponentFactory.create (http://localhost:3000/vendor.bundle.js:7840:30)
    at ViewContainerRef_.createComponent (http://localhost:3000/vendor.bundle.js:9699:67)
    at RouterOutlet.activate (http://localhost:3000/vendor.bundle.js:29593:43)
    at ActivateRoutes.placeComponentIntoOutlet (http://localhost:3000/vendor.bundle.js:28903:19)
    at ActivateRoutes.activateRoutes (http://localhost:3000/vendor.bundle.js:28870:29)
    at http://localhost:3000/vendor.bundle.js:28806:61
    at Array.forEach (native)
    at ActivateRoutes.activateChildRoutes (http://localhost:3000/vendor.bundle.js:28806:32)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions