Getting error "observableArray is not a constructor"


#1

I’m trying to define a new array with following code but getting error “observableArray is not a constructor”. What am I doing wrong?

XML

// for creating a select field
<dd:DropDown items="{{ states }}"  selectedIndexChanged="dropDownSelectedIndexChanged" />

JS

const observableArray = require("data/observable-array").observableArray;
...
function onNavigatingTo(args) {
    const page = args.object;

    var states = new observableArray();
}

exports.onNavigatingTo = onNavigatingTo;

Also tried

var observableArray = require("data/observable-array");
...
function onNavigatingTo(args) {
    const page = args.object;

    var states = new observableArray.observableArray()
}

#2

I don’t know if its related or not but I followed this very simple tutorial to add a sidedrawer to my app and I got the error “RadSideDrawer is not a constructor”. Have I done something terribly wrong with the app?


#3

It’s .ObservableArray() not .observableArray(), this is why I love TypeScript saves lot of time from silly mistakes.


#4

Oh dear god. Thats embarassing :weary: