我有一些數學,我需要做的,我用剃刀在所有這些數字來拉在數組中。我不會立即數它們,因爲我需要稍後再過濾它們。淘汰賽。長度或.Count之間
我可以在陣列中我的數據綁定現場打印,但我不能添加。長度或.Count中這是行不通的。我究竟做錯了什麼?
淘汰賽
<script>
var thePage = function() {
var self = this;
self.All = ko.observableArray(@Html.Raw(Json.Encode(Model.All.Select(i => i.Number))));
self.SomePercentage = ko.observable(@Html.Raw(Json.Encode(Model.Percentage)));
self.someTotal = ko.pureComputed(function() {
var total = self.All // .length? .count? what goes here to count all the items I have in my array?!;
return total;
});
};
ko.applyBindings(new thePage());
</script>
試self.All()。長度 –