我正在使用AngularJS UI-Grid,并试图过滤定价。对于小数点后面的0以外的任何数字,过滤都可以正常工作。
$scope.GridOptions = {
enableFiltering: true,
rowEditWaitInterval: -1,
multiSelect: true,
enableColumnMenus: false,
columnDefs: [
{ name: 'Name', field: 'Item', width: '15%' },
{ name: 'Price', field: 'Price', type: 'number', cellFilter: 'currency', width: '6%' },
{ name: 'Current Price', field: 'CurrentPrice', type: 'number', cellFilter: 'number: 2', width: '12%' }
]
2 after decimal, 0 after decimal
角js有一个内置的货币过滤器。在模板中,您可以执行类似{{item_price |货币}},在ng-repeat内部,如果你需要的话(它看起来像你) – Peege151
它读取它作为货币,但它仍然过滤掉任何会读取'.0'的东西。 – Thecor