2017-04-18 7 views
0

ng-repeatを使用してdivに出力する標準JSONがあります。ng-repeat内で複​​数の角度フィルタを使用する

[ 
{ 
    "info": "CA", 
    "label": "STATE", 
    "displayLabel": "['pInformation']['State__c']", 
    "type": "string", 
    "group": "Custom Properties", 
    "collapse": true, 
    "editing": false 
}, 
{ 
    "info": "2017-04-17T23:29:37.000Z", 
    "label": "Date Time", 
    "displayLabel": "['pInformation']['DateTime__c']", 
    "type": "string", 
    "group": "Custom Properties", 
    "collapse": true, 
    "editing": false 
    }, 
{ 
    "info": "2017-23-17T23:32:37.000Z", 
    "label": "Date", 
    "displayLabel": "['pInformation']['Date__c']", 
    "type": "string", 
    "group": "Custom Properties", 
    "collapse": true, 
    "editing": false 
    } 
] 

<dl ng-repeat="fields in data.fields"> 
    <dd>{{fields.label}}</dd> 
    <dd>{{fields.info}}</dd> 
</dl> 

私は2番目と3番目のノードに対する角度日付フィルタを追加したい場合は、次の

  • 第二:日付: 'MM-DD-YYYY HH:MM'
  • 第三:日付: 'MM-DD-YYYY'

答えて

0

使用$インデックス:

<dl ng-repeat="fields in data.fields"> 
<div ng-show="$index != 1 || $index != 2"> 
    <dd>{{fields.label}}</dd> 
    <dd>{{fields.info}}</dd> 
</div> 
<div ng-show="$index == 1 || $index== 2"> 
    <dd>{{fields.label}}</dd> 
    <dd>{{fields.info || someDateFilter}}</dd> 
</div> 
</dl> 
関連する問題