Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paper-input-container attach causes "Cannot read property 'addEventListener' of null" #107

Closed
stfnzl opened this issue Nov 23, 2020 · 1 comment

Comments

@stfnzl
Copy link

stfnzl commented Nov 23, 2020

First of all, thanks for this great library!

I'm trying to run a simple example using paper-input-container like in the example below:

<paper-input-container>
  <div slot="input">
    <input type="text" />
  </div>
</paper-input-container>

Looking at the console I get the following error:

Uncaught TypeError: Cannot read property 'addEventListener' of null
    at HTMLElement.attached (paper-input-container.js:534)
    at HTMLElement.attached (class.js:391)
    at HTMLElement.connectedCallback (legacy-element-mixin.js:228)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runGuarded (zone.js:161)
    at HTMLElement.connectedCallback (zone.js:144)
    at EmulatedEncapsulationDomRenderer2.push../node_modules/@angular/platform-browser/fesm5/platform-browser.js.DefaultDomRenderer2.appendChild (platform-browser.js:1053)
    at DebugRenderer2.push../node_modules/@angular/core/fesm5/core.js.DebugRenderer2.appendChild (core.js:11429)
    at createElement (core.js:8125)
    at createViewNodes (core.js:10360)

Setting a breakpoint at paper-input-container.js:534 I see that the null object is _inputElement (get by dom(this).querySelector(this._inputSelector)).

Inspecting the dom with the breakpoint active I can see that the input is not jet present in the DOM.

image

How could we defer the paper-input-container attached until the input has need dumped into the DOM?

@stfnzl
Copy link
Author

stfnzl commented Nov 23, 2020

Using <router-outlet></router-outlet> everything works as expected.
Feel free to close the issue if you do not have any comment on that :)

@stfnzl stfnzl closed this as completed Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant