我有一個包含類型和名稱地址2門陣列等等如下模型:Knockoutjs有關的foreach孩子父母
var model = [{"bstype":1},{"bstype":2},{"bstype":3},{"bstype":4}],
[{"bstype":1, "name":"John","Address":"Sample address"},
[{"bstype":1, "name":"John","Address":"Sample address"},
[{"bstype":3, "name":"John","Address":"Sample address"},
{"bstype":2 ,"name":"John","Address":"Sample address"}];
[{"bstype":2, "name":"John","Address":"Sample address"},
[{"bstype":4, "name":"John","Address":"Sample address"}];
什麼,我想要它做的是創建的列表:
類似於
I am not sure about this part how to implement it that is why it was gibberish.
bstype":1 will have a view of following
[{"bstype":1, "name":"John","Address":"Sample address"},
[{"bstype":1, "name":"John","Address":"Sample address"},
bstype"2: will have a view of following
{"bstype":2 ,"name":"John","Address":"Sample address"}];
[{"bstype":2, "name":"John","Address":"Sample address"},
bstype":3 has only one
[{"bstype":3, "name":"John","Address":"Sample address"},
等等等等。
我正在使用淘汰賽我檢查了網站,它只討論關於foreach但不知道如何訪問子元素。
我希望這是有道理的。
由於
你的例子中的語法沒有意義......你已經定義了一個列表,然後是一堆東西。你能解決這個問題嗎?這樣我們可以更清楚地看到你在做什麼? – bdesham 2013-03-06 17:34:50