Angular js ng-show 不适用于本机数学表达式

Angular js ng-show doesn't work with native Math expression

这不起作用(div 从未出现):

<div ng-show="parseFloat(vehicle.pricing) > 1">

这确实有效:

<div ng-show="vehicle.pricing > 1">

为什么?

除非您在 $scope/scope 上创建了 parseFloat 函数,否则 DOM 将无法使用它。唯一可用的是比较和您附加到 $scope/scope.

的东西

查看 angular 提供的过滤器:https://docs.angularjs.org/api/ng/filter 可能有一个您可以使用。