【发布时间】:2018-05-08 07:57:12
【问题描述】:
我的 JSON 结构如下:
[
{
"_id": "0",
"_rev": "1",
"url": "fb.com",
"ownership": {
"line": "social"
},
"id": 13,
"hierarchies": [
{
"level": 30,
"level40_desc": "",
"pairing": "6950-9X",
"level30_desc": "facebook",
"level30_id": "6941-0P",
"mirror": "",
"level17_id": "1CMA",
"fin_div": "M3",
"id": "6941-0P"
}
]
},
{
"_id": "02ad9973a97f82db1c",
"_rev": "1-8788cdde1205ca608a3",
"url": "www.google.com",
"ownership": {
"line": "social"
},
"id": 159,
"hierarchies": [
{
"level": 30,
"level40_desc": "",
"pairing": "6950-9L",
"level30_desc": "google",
"level30_id": "6941-9L",
"mirror": "",
"level17_id": "1CMA",
"fin_div": "M3",
"id": "6941-9L"
}
]
},
{
"_id": "01c555f2333a97f82e837",
"_rev": "1-0101ae7cc842f43c9a40",
"url": "www.twitter.com",
"ownership": {
"line": "social"
},
"id": 14,
"hierarchies": [
{
"level": 30,
"level40_desc": "",
"pairing": "6950-8M",
"level30_desc": "twitter",
"level30_id": "6941-8M",
"mirror": "",
"level17_id": "1CMA",
"fin_div": "M3",
"id": "6941-8M"
}
]
}
]
在控制器中我有这个 JSON 在vm.searchData 中,在 HTML 显示中我将数据显示为
<div ng-repeat="item in vm.searchData track by $index">
<div id="{{item.url}}">
<a class="search-results" href="" ui-sref="." ng-repeat="item1 in item.hierarchies track by $index">{{item1.level30_desc}}-{{item1.level30_id}}</a>
</div>
</div>
如果我想将显示的元素与 JSON 中可用的 URL 进行超链接,然后单击超链接应在新选项卡中打开...我将如何实现这一点
【问题讨论】:
标签: javascript angularjs json