我想呈現文本,如果它是名稱或值。如果它是創建或enventId,我不想循環。我正在嘗試使用Filter和ng-if條件。它不工作。angularjs ng-repeat with Filter或ng-if條件
HTML代碼
<tr ng-repeat="event in events | filter:Name ">
<td >{{event.Name}} : </td>
<td>{{ event.Value }}</td>
</tr>
JS代碼
Events: [
{
CreatedTime: "/Date(1420757322810-0800)/",
EventId: 13,
Name: "AdGroupId",
Value: "2367898"
},
{
CreatedTime: "/Date(1420757322810-0800)/",
EventId: 13,
Name: "AdGroupId",
Value: "2367898"
}
]
我希望得到的結果應該是
AdGroupId:2367898
所以你想壓制沒有name屬性的事件,對吧? – hgoebl 2015-01-15 18:16:44
這沒有意義。只需刪除你的過濾器,並簡單地循環「事件中的事件」,然後你可以選擇只在你的html中呈現Name和Value,如你現在所做的那樣 – floribon 2015-01-15 18:20:48
爲什麼?我有100多場比賽。如果它不是名稱/值,我不想重複循環。我想補充條件。 – user3194721 2015-01-15 18:23:27