Why AngularJS currency filter formats negative numbers with parenthesis?

后端 未结 7 719
别跟我提以往
别跟我提以往 2020-12-28 14:05

Live Demo

Why this:

# Controller
$scope.price = -10;

# View
{{ price | currency }}

results in ($10.00) rather than

7条回答
  •  被撕碎了的回忆
    2020-12-28 14:37

    Update: Angular 1.4 no longer uses parentheses to indicate negative values but now uses the "-" symbol. Here is a link to a discussion: https://github.com/angular/angular.js/issues/12870

    I used the decorator as described by marc to return the .negPre and .negSuf to use the parens.

提交回复
热议问题