我有這樣一個JSON -比較兩個數組和改變風格NG-重複項目的角度
[{
"id": "152",
"name": "Accounting",
"parent_id": "0",
"created_at": "2016-12-20 18:10:57",
"updated_at": "2016-12-20 18:10:57"
}, {
"id": "292",
"name": "Administration",
"parent_id": "0",
"created_at": "2016-12-20 18:37:29",
"updated_at": "2016-12-20 18:37:29"
}, {
"id": "422",
"name": "Banquet",
"parent_id": "0",
"created_at": "2016-12-20 18:43:26",
"updated_at": "2016-12-20 18:43:26"
}, {
"id": "502",
"name": "Engineering & Maintenance",
"parent_id": "0",
"created_at": "2016-12-20 18:47:12",
"updated_at": "2016-12-20 18:47:12"
}, {
"id": "622",
"name": "Food & Beverage Admin",
"parent_id": "0",
"created_at": "2016-12-20 18:51:00",
"updated_at": "2016-12-20 18:51:00"
}, {
"id": "782",
"name": "Food & Beverage Service",
"parent_id": "0",
"created_at": "2016-12-20 18:56:38",
"updated_at": "2016-12-20 18:56:38"
}, {
"id": "982",
"name": "Front Office",
"parent_id": "0",
"created_at": "2016-12-20 19:05:04",
"updated_at": "2016-12-20 19:05:04"
}, {
"id": "1212",
"name": "Housekeeping & Laundry",
"parent_id": "0",
"created_at": "2016-12-20 19:15:48",
"updated_at": "2016-12-20 19:15:48"
}, {
"id": "1352",
"name": "HR",
"parent_id": "0",
"created_at": "2016-12-21 10:12:38",
"updated_at": "2016-12-21 10:12:38"
}, {
"id": "1462",
"name": "IT",
"parent_id": "0",
"created_at": "2016-12-21 10:16:14",
"updated_at": "2016-12-21 10:16:14"
}, {
"id": "1492",
"name": "Kitchen/Food Preparation",
"parent_id": "0",
"created_at": "2016-12-21 10:17:29",
"updated_at": "2016-12-21 10:17:29"
}, {
"id": "1712",
"name": "Purchase",
"parent_id": "0",
"created_at": "2016-12-21 10:26:09",
"updated_at": "2016-12-21 10:26:09"
}]
這是我在與NG-重複列表我迭代。
現在我有另一個數組一樣
[152,292,422,1712].
現在我該怎樣與第一陣列的ID第二陣列相匹配,並改變這些ID匹配的對象的樣式在視圖中。
請建議。
任何人都可以幫助我嗎? –