0
我有一个带有用户数据表单的角度模板。角度ng显示不反映条件的值
<div class="personal-details" ng-show="showInvoiceFields()">
<!-- input fields here... -->
</div>
我在当前用户有“发票的作用”,或者如果产品需要发票,则返回true范围的功能showInvoiceFields()
:如姓名和地址某些字段只有当用户需要发票证明。
$scope['showInvoiceFields'] = function() {
console.log('hasInvoiceRole: ' + $scope['hasInvoiceRole']);
console.log('product:');
console.log($scope['product']);
return $scope['hasInvoiceRole'] || $scope['product'].needsInvoice;
};
表单的这一部分最初是隐藏的,直到从下拉列表中选择一个产品为止。最初,我在控制台看这一点,因为用户没有发票的作用:
hasInvoiceRole: false
product needs invoice:
undefined
undefined
当我选择需要发票的产物,我读:
hasInvoiceRole: false
product needs invoice:
{... a ver big object..., needsInvoice: true, ...}
然而字段不显示。这只发生在生产中。也许有关于导致问题的缩小代码的具体内容?