0

我正在尝试使用以下初始数据设置我的视图模型。

var initialVMData = [{"title":"Mrs","otherTitle":null,"forename":"Tom","surname":"Sam"},{"title":"Miss","otherTitle":null,"forename":"Sarah","surname":"Miller"}]

这是我的jsFiddle

我正在努力初始化我的视图模型,以便在第一页加载时有两条记录已经填充了上面的 JSON(initialVMData)。我尝试过使用映射插件,但还没有成功。实现这一目标的最简单方法是什么?

谢谢

4

1 回答 1

2

Try this one. JSFiddle

First you need to provide an option to initialize your JointHolder objects with some data. Then you need to map your jointholders array with JSON data. I've used $.map function for that. And that's it.

于 2013-11-13T18:56:02.690 回答