简体   繁体   English

Angularjs 计算不适用于 iPad / iPhone 上的 safari

[英]Angularjs calculation not working on safari on iPad / iPhone

I have a calculation in AngularJS which calculates a cost.我在 AngularJS 中有一个计算成本的计算。 It works fine in all browsers (that i have tested on) except from Safari on iPads and iPhones.除了 iPad 和 iPhone 上的 Safari,它在所有浏览器(我已经测试过)中都能正常工作。

The calculation looks like this:计算如下:

£ {{ ((((((((height * width) / 1000000) * square_meter_price) + panel_price) * 1)) * (1 + (lookup.dl_markup-0) + (Colours.options.markup-0))) + (lookup.dl_extra_cost-0) + (Colours.options.extra_cost-0) + (hingeholesno * hinge_hole_price)) * panel_quantity | number : 2 }}

On safari on iPad / iPhone it displays the above code rather than the cost (overall calculation)在 iPad / iPhone 上的 safari 上,它显示上面的代码而不是成本(总体计算)

Any ideas on how to resolve this would be greatly appreciated as i've searched for hours with no joy.任何关于如何解决这个问题的想法都将不胜感激,因为我已经搜索了几个小时而没有任何乐趣。

i resolved this by using $watch in the controller:我通过在控制器中使用 $watch 解决了这个问题:

    $scope.$watch('((((((((height * width) / 1000000) * square_meter_price) + panel_price) * 1)) * (1 + (lookup.dl_markup-0) + (Colours.options.markup-0))) + (lookup.dl_extra_cost-0) + (Colours.options.extra_cost-0) + (hingeholesno * hinge_hole_price)) * panel_quantity | number : 2', function(fc) {$scope.FullCost = fc;});

Then using {{FullCost}} in the HTML - it now works and displays in all devices然后在 HTML 中使用{{FullCost}} - 它现在可以在所有设备中工作并显示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM