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

"Error: Uncaught (in promise): TypeError: Cannot read property 'length' of null" error thrown when using <inline-editor type="textarea" when [(ngModel)]="null" #92

Closed
jmorganmartin opened this issue Sep 13, 2017 · 4 comments
Labels

Comments

@jmorganmartin
Copy link
Contributor

jmorganmartin commented Sep 13, 2017

The error is fairly self-explanatory. Using version 0.2.0-alpha.11.

Here is my code:

<inline-editor type="textarea" [(ngModel)]="booking.description" (onSave)="updateBookingDescription($event)" cols="35" placeholder="Add Notes Here"></inline-editor>

If booking.description is null, triggers the error:

Error: Uncaught (in promise): TypeError: Cannot read property 'length' of null

The workaround is to write a quick check to prevent passing a variable that might be null (an empty string, '', is fine). I believe this issue is new to one of the recent updates.

Triggered in ngx-inline-editor.es5.js (line 235):

            var _a = this.config, min = _a.min, max = _a.max;
            var /** @type {?} */ length = this.isNumeric ? Number(value) : value.length;

If value is null, value.length triggers this error.

@tonivj5
Copy link
Collaborator

tonivj5 commented Sep 14, 2017

Hi @jmorganmartin, thanks for your reporting and help! 👍

Yeah, it seems easy to fix. I will fix it when I have time (maybe, next weekend), however if you want help us, you could open a PR 😉

@jmorganmartin
Copy link
Contributor Author

@xxxTonixxx I'm working on it right now. Ran into a separate issue trying to build.

@jmorganmartin
Copy link
Contributor Author

#95

@tonivj5
Copy link
Collaborator

tonivj5 commented Sep 25, 2017

Fixed in #95

@tonivj5 tonivj5 closed this as completed Sep 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants