1

I would like to add the | currency filter to just the field following field:
{ title: localizationBundle.AverageGross, field: 'AvgGrossDays30', visible: true }

If I use the following, but it adds the currency filter to all of them:

{{fsiItem[column.field] | currency}}

Any assistance and guidance would be appreciated.

 <tr ng-repeat="fsiItem in $data">
                <td ng-repeat="column in columns" ng-show="column.visible" sortable="false">
                    {{fsiItem[column.field]}}
                </td>
            </tr>


$scope.columns = [
                { title: localizationBundle.FastestSellingGroupName, field: 'FastestSellingGroupName', visible: true },
                { title: localizationBundle.Sales180Days, field: 'SaleDays180', visible: true },
                { title: localizationBundle.Sales30Days, field: 'SaleDays30', visible: true },
                { title: localizationBundle.InStock, field: 'InStock', visible: true },
                { title: localizationBundle.AverageGross, field: 'AvgGrossDays30', visible: true }
    ];

1 Answer 1

1

You could do by simply applying conditional Ternary operator

<td ng-repeat="column in columns" ng-show="column.visible" sortable="false">
 {{column.field == 'AvgGrossDays30' ? (fsiItem[column.field]| currency): fsiItem[column.field]}}
</td>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.