Just sharing some tips... If my viewmodel implements the "Revealing Prototype Pattern", even if I'm returning a promise from activate function, the binding will not works.
So in this case I must return a ko.computed observable that wraps my entity.
define(['services/dataService'], function (DataService) {
var ViewModel = function () {
//...
}
ViewModel.prototype = function () {
//
var dataservice = new DataService('api/todo');
var entity = ko.observable();
return {
activate: function(data) {
//async operation
dataservice.get("Todo", data.splat[0]).then(function(result){
entity(result);
});
},
model: ko.computed(function(){
return entity();
}),
}
}();
return new ViewModel();
});
<div>
<input type="text" data-bind="model().Description" />
</div>
This works fine. Anytime my entity changes, the computedObservable will update the bindings.