Skip to content

value.slice() is not a function when prefilled with number #50

Description

@RANSoftRA

I am running into an issue when the value of the field is pre-filled with a number (bound with ngModel). Seems like the code is expecting a string as a value - hence the problem when the input value is a number (the slice function is not available).

image

Error occurs on line 7115 in ngx-material-keyboard-core.js:

    MatKeyboardKeyComponent.prototype.onClick = function (event) {
        ....        
        var value = this.inputValue; // value is a number
        ....
        if (char && this.input) {
            this.inputValue = [value.slice(0, caret), char, value.slice(caret)].join(''); // error here
            this._setCursorPosition(caret + 1);
        }
    };

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions