当通过 IOS 上的 PhoneGap 2.7.0 中的 InAppBrowser 访问我用 AngularJS 1.2.0rc1 构建的网站时,ng-show 的内容在屏幕上闪烁。
<form method="POST" action="" name="manualEntryForm" class="form-inline">
<div ng-show="showErrors && !manualEntryForm.$valid" class="errorMsg ng-hide">
One or more of the following fields are required:
<span ng-show="manualEntryForm.month.$error.required || manualEntryForm.day.$error.required || manualEntryForm.year.$error.required" class="ng-hide">Date needs to be present</span>
...
</div>
...
</form>
无论我将 showErrors
默认为 false 还是更严格地测试它 (showErrors === true
),该错误内容 block 都会显示,并且还会显示显示相关的实际错误消息(需要提供日期
)。
我很困惑如何解决这个问题。我们不应该在 ng-show 中使用 Angular Form Validation 吗?为什么它只在 IOS/Phonegap InAppBrowser 上引起问题?
最佳答案
我也遇到了同样的问题。 ng-cloak 没有解决问题,所以对我来说解决问题的是添加
class="ng-hide"
给每个元素加上ng-show属性,现在在ios上不会闪现内容了。
关于angularjs - PhoneGap + Angular + IOS = ng-show 在屏幕上闪烁内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20959107/