Create new checkbox from js code

nativescriptcore

#1

how can I create new checkbox from js code? I’m using this pugin:
https://www.npmjs.com/package/nativescript-checkbox

I tried:
const CheckBox = require(‘nativescript-checkbox’);
const myCheckBox = new CheckBox();

but its not working.
error is: Object is not a constructor.

@bradwaynemartin @wwwalkerrun


#2

Your error has all details, it supposed to be

const CheckBox = require(‘nativescript-checkbox’).CheckBox ;

This is one of the reasons why TypeScript feels great :wink: