question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'createRange' of undefined

See original GitHub issue

Hello,

I got this error when using ngx-currency with material input.

<input matInput type="number" placeholder="0" formControlName="buildingValue" required currencyMask >
TypeError: Cannot read property 'createRange' of undefined
    at InputManager.get [as inputSelection] (input.manager.js:46)
    at InputManager.get [as canInputMoreNumbers] (input.manager.js:27)
    at InputService.get [as canInputMoreNumbers] (input.service.js:137)
    at InputHandler.push../node_modules/ngx-currency/src/input.handler.js.InputHandler.handleKeypress (input.handler.js:82)
    at CurrencyMaskDirective.push../node_modules/ngx-currency/src/currency-mask.directive.js.CurrencyMaskDirective.handleKeypress (currency-mask.directive.js:76)
Angular CLI: 7.3.9
Node: 10.16.0
OS: win32 x64
Angular: 7.2.15
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

5reactions
dhermytcommented, Sep 13, 2019

@Cerbrus the issue is with type="number". If you remove this then it works nicely. The error message should be different though, because it took me a while to find the cause.

1reaction
Cerbruscommented, Sep 13, 2019

Well that helps! It works like a charm now.

This should probably be documented somewhere.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to get property 'createRange' of undefined or null ...
When an object is null you cannot query it, because the structure containing the information you need does not exist. Share.
Read more >
Cannot read property 'createRange' of undefined #30 - GitHub
Uncaught TypeError: Cannot read property 'createRange' of undefined at t.default (get-input-selection.js:1) at t.value (bundle.js:1) at ...
Read more >
Unable to get property 'createRange' of undefined or null ...
I'm going to propose a hack, that may or may not work since I have no way to test it myself. As you...
Read more >
Unable to get property 'createrange' of ... - CodeProject
Let me just explain what the error means: You have tried to use a variable, property, or a method return value but it...
Read more >
JavaScript runtime error: Unable to get property createRange ...
But i am getting error : 0x800a138f - JavaScript runtime error: Unable to get property 'createRange' of undefined or null reference.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found