The JSON structure I am working with is shown below:
[
{
"_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"
}
]
}
]
Within the controller, I have stored this JSON data in vm.searchData
. In the HTML display, I am rendering the data as follows:
<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>
If I want to create hyperlinks for the displayed elements and make them open in a new tab when clicked, how can I achieve this functionality?