【发布时间】:2014-07-12 02:52:52
【问题描述】:
我有一个表达式我想迁移到 javascript 以保持 $scope 中可用的对象值:
<dl class = "mortgage-information">
<dt><abbr title = "Loan-to-value Ratio">LTV</abbr></dt>
<dd>{{(total_financing ? total_financing : financing)/ property_value}}</dd>
</dl>
但是将相同的表达式迁移到 javascript 将始终导致 financing 而不是 total_financing (Coffeescript):
$scope.ltv = (if $scope.total_financing then $scope.total_financing else $scope.financing) / $scope.property_value
我一直在阅读the documentation on angular expressions to no avail。任何人都可以建议将表达式迁移到 javascript 的更好方法吗?
【问题讨论】:
标签: javascript angularjs coffeescript