I am trying to replace the contents of an observable array with an array that is returned from a promise.
I initialize an observable array like so
let contents = ko.observableArray([]);
And the array that is returned from the promise looks something like this
[{name : test, code : 0, country : UK}]
How can replace the empty observable array with the contents of the array that is returned from the promise?
I have tried this
promise.then(array => {contents(array)});
As well as this
promise.then(function(value){contents(value)})
but neither of them add anything into the observable array.