Use filter on ng-options to change the value displayed

前端 未结 3 878
栀梦
栀梦 2020-12-01 03:17

I have an array of prices (0, 0.99, 1.99... etc) that I want to display in

This way, the filter is useful for single values, rather than operating only on arrays. If you have objects and corresponding formatting filters, this is quite useful.

Filters can also be used directly in code, if you need them:

var formattedPrice = $filter('price')(num);

提交回复
热议问题