标题是愚蠢的,因为我和这个标题一样:) 我不知道这是否可能,但我不得不问.. 我在 Angularjs 中使用带有 JSON 的 ng-repeat,我得到的是一个包含这些值的列表..
<ul>
<li class="name">Nokia</li>
<li class="name">Nokia</li>
<li class="name">Nokia</li>
<li class="name">ZTE</li>
<li class="name">ZTE</li>
<li class="name">Samsung</li>
<li class="name">Samsung</li>
<li class="name">ZTE</li>
</ul>
所以从这个列表中我想做这样的东西
<ul>
<li class="name">Nokia</li>
<li class="name">ZTE</li>
<li class="name">Samsung</li>
</ul>
现在我不知道,我用 jQuery 尝试了一些东西但没有成功......我的问题是,这是否可能,如果是,有什么建议吗?
好的,所以你们要求查看我的 JSON,但 @nnnnnn 已经解决了我的问题。这只是我一直在使用的 JSON 的一部分...如果我的结构不好,您可以随意说; )
var store = [
{
"category": "mobile",
"description": "Mobile Phones",
"products" :
[
{"manufacturer": "Nokia", "name":"Nokia 301", "price": 100, "quantity": 0, "img": "nokia301-front"},
{"manufacturer": "ZTE", "name":"ZTE FTV", "price": 300, "quantity": 0, "img": "zteftv-front"},
{"manufacturer": "ZTE", "name":"ZTE Blade 3", "price": 500, "quantity": 0, "img": "zteblade3-front"},
{"manufacturer": "Sony", "name":"Sony Xperia E", "price": 600, "quantity": 0, "img": "sonyxperiae-front"},
{"manufacturer": "Samsung", "name":"Samsung Galaxy Ace Plus", "price": 300, "quantity": 0, "img": "samsunggalaxyaceplus-front"},
{"manufacturer": "ZTE", "name":"ZTE Blade G", "price": 350, "quantity": 0, "img": "ztebladeg-front"},
{"manufacturer": "LG", "name":"LG Optimus L7 II", "price": 600, "quantity": 0, "img": "lgoptimusl7ii-front"},
{"manufacturer": "HTC", "name":"HTC Desire X", "price": 500, "quantity": 0, "img": "htcdesirex-front"},
{"manufacturer": "Nokia", "name":"Nokia Lumia 620", "price": 500, "quantity": 0, "img": "nokialumia620-front"}
]
},
{
"category": "laptop",
"description": "Laptops",
"products" :
[
{"name":"Asus X55A", "price": 400, "quantity": 0, "img": "asusx55a-front"},
{"name":"Samsung Series 9", "price": 500, "quantity": 0, "img": "samsungseries9-front"}
]
},
{
"category": "tablets",
"description": "Tablet Devices",
"products" :
[
{"name":"Prestigio Touch", "price": 270, "quantity": 0, "img": "prestigiotouch-front"},
{"name":"Samsung Galaxy Tab 2 7.0", "price": 400, "quantity": 0, "img": "samsunggalaxytab270-front"},
{"name":"Samsung Galaxy Note 10.1", "price": 430, "quantity": 0, "img": "samsunggalaxynote101-front"}
]
}
];