How to use knockout to iterate over an object (not array)

前端 未结 8 574
不知归路
不知归路 2020-12-04 23:31

I want to use something similar to the Knockout foreach construct to iterate over the properties of an object. Here is what I am trying to create...

DESIRED

8条回答
  •  生来不讨喜
    2020-12-05 00:37

    Supposedly, there is a deeper problem (see this thread at Google groups) that is that foreach treats the object as a dictionary of parameters, not as the collection to iterate.

    My best solution so far is to combined foreach in Object.keys(myobject) and 'with' binding context.

提交回复
热议问题