You need to return
the promise in the activate
function, otherwise it won't know when the promise has completed.
var activate = function () {
return groupsData.GetRoots().then(function (data) {
roots($.map(data, function (it) { return new groupNode.GroupNode(it); }));
});
};
If you do this, databinding wont occur until the promise has finished, which will remove the race condition you are seeing.