fredguile / ng2-md-datatable

Angular 5+ DataTable component for using with Material Design 2
https://www.npmjs.com/package/ng2-md-datatable
MIT License
38 stars 13 forks source link

Selectable Unexpected end of JSON input error #47

Closed kalibegovic closed 7 years ago

kalibegovic commented 7 years ago

Hello, this new release ( 14001d068c4d809b36ffa7db5765714784961e27 ) created a bug when using "selectable".

ex.

<ng2-md-datatable selectable>
</ng2-md-datatable>

and I get following error

ERROR SyntaxError: Unexpected end of JSON input
    at Object.parse (<anonymous>)
    at MdDataTableComponent.set [as selectable] (md-datatable.component.js:51)

when using

<ng2-md-datatable selectable="true">
</ng2-md-datatable>

everything works fine.

problem is on this line:

    Object.defineProperty(MdDataTableComponent.prototype, "selectable", {
        set: function (val) {
            if (typeof (val) === 'boolean') {
                this.isSelectable = val;
            }
            else {
                this.isSelectable = JSON.parse(val); <==  #ERROR
            }
        },
        enumerable: true,
        configurable: true
    });
fredguile commented 7 years ago

Im very sorry, the CI reveals that too. I'll fix it tomorrow, promise!

jj-julia commented 7 years ago

I am also getting the same error. Would greatly appreciate a fix :)

fredguile commented 7 years ago

Guys, all my apologies for the breaking release. I hope that 1.3.16 fixes the issue. That will be a lesson for next releases... never disregard CI ;)