基本的に、オブジェクトを共有するページに 2 つの ng-repeat があります。データと一致する場合にのみ項目を繰り返したいtype
。
モック オブジェクト
$scope.events = [
{
date: "1/16/13",
time: "11:30",
type: "First",
restaurant: "Quiznos",
location: "Echo",
cuisine: "American",
link: "http://google.com/event?id=239292"
},
{
date: "1/16/13",
time: "1:30",
type: "Second",
restaurant: "Snarfs",
location: "5th Floor",
cuisine: "American",
link: "http://google.com"
}
];
マークアップ
<tr ng-repeat="event in events.type " onClick="window.open('{{event.link}}','_blank');">
<td>{{event.time}}</td>
<td>{{event.restaurant}}</td>
<td>{{event.location}}</td>
<td>{{event.cuisine}}</td>
</tr>
したがって、2 つの ng-repeat が必要です。タイプ = First の場合はオン、タイプ = セカンドの場合は 1 つ
何かのようなものng-repeat="event in events.type = 'First'"