答案 0 :(得分:15)
此功能有效(基于http://knockoutjs.com/examples/animatedTransitions.html:)
get: function(role)
{
return ko.dependentObservable(function ()
{
return ko.utils.arrayFilter(this.personRoles(), function(item)
{
return item.id == role;
});
}, viewModel);
}
答案 1 :(得分:0)