[英]Is there a way to use ko.observableArray as map?
Is there a way to use an ko.observableArray like a map/dictionary? 有没有办法像地图/字典一样使用ko.observableArray ?
For example: 例如:
var arr = ko.observableArray();
arr.push('key', { '.. Some object as value ..' });
And then retrive the value using the key: 然后使用密钥检索值:
var value = arr['key'];
Found two possible implementations: 找到两种可能的实现:
I ended up using the observableDictionary, it is fast and simple. 我最终使用了observableDictionary,它快速而简单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.